[rspec-users] A puzzling spec failure in a shared describe

Mark Van De Vyver mvyver at gmail.com
Tue Sep 11 23:02:56 EDT 2007

Thanks for all the effort that has gone into making RSpec available.
I'm not a professional developer and I've found the approach
articulated has helped me a lot in writing my code, and understanding
that of others.

To cut my teeth, I'm trying to write an db adapter for the og project.

I've being iterating with RSpec and it's exposed some unexpected
behavior in OG, and helped me to understand some of OGs behavior, but
I've hit a snag.....
Perhaps someone will be kind enough to point out why I see the 4
failures listed in the
attached log when I run the attached spec file, and even kinder to
suggest how I might get this working :)

Specifically, I'm puzzled by the following failure:

'A default (DbiAdapter) connection to a new Og store should refer to
the default database in its 'name' attribute.' FAILED
expected: :memory,
    got: "test" (using ==)

The text refers to the description of a set of expectatons far away
from the lines references, in fact those line numbers refer to
different describe section altogether.  The 'got "test"' suggest it
was running a spec around the line numbers cited, but the describe
'text' is out of sync.

I suspect I'm don't understand the scope and contexts of the rspec
components, or I may just be doing things back to front - I've read
the simple tutorials, but have found and more advanced "how to" just
yet - I'd greatly appreciate any pointers/hints someone can offer.

There do seem to be some issues, such as 'you can't use an objects
method twice in a describe block', but I may be misunderstand
something I've seen?

Anyway, hopefully it is not necessary, but if you need to run the spec
file I can try help you get OG to that point, but that could be tricky
- not all changes I've made have been
submitted or accepted yet.

Hopefully you can just see my error from a glance at the spec file?

Perhaps you can comment on what should be done differently to be
closer to rspec best-practice.
I think this is the first adapter spec file so can probably be used as
a template for others in the project?

As I said, I suspect I'm missing something about how rspec works... one issue
that isn't clear from the rspec site is the scope of variables in a
spec file...

Final Q:
Has there been a resolution of the Mock issue, i.e will it rspec
implementation stay in rspec or not.
Which of mocha and flexmock are most compatible (i.e. work) with
rspec, or is there a 'better' mock project to use with rspec.

Appreciate any help or insight you can offer.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbi.rb
Type: application/x-ruby
Size: 12540 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070912/61840dc6/attachment-0004.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drbi_rb_test.log
Type: text/x-log
Size: 1806 bytes
Desc: not available
Url : http://rubyforge.org/pipermail/rspec-users/attachments/20070912/61840dc6/attachment-0005.bin 

More information about the rspec-users mailing list