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

Mark Van De Vyver mvyver at gmail.com
Thu Sep 13 01:49:19 EDT 2007


Hi,

On 9/13/07, Christopher D. Pratt <chrisdpratt at gmail.com> wrote:
> I'm not really sure about your error, so hopefully someone more skilled than
> me can help you with that.

OK, turns out this problem was due to 'bad dehavior' in another part
of the code base...
Spec'ing exposed it but it'll take me some time to get used to
debugging this way - more reasons to spec from the outset....

> As far as the "mock issue" goes, I don't think that was anything more than a
> suggestion. I don't foresee RSpec removing it's built in mocking. If you
> want/need to use another mocking framework, I know that Mocha and RSpec play
> well. Not sure about FlexMock.

Thanks Chris that is good to know.

Regards
Mark
>
> Chris Pratt
>
>
>
> On 9/11/07, Mark Van De Vyver <mvyver at gmail.com> wrote:
> >
> > Hi,
> > 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:
> >
> > 1)
> > '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 ==)
> > /usr/src/nitro-repo/og/test/og/adapter/dbi.rb:242:
> > /usr/src/nitro-repo/og/test/og/adapter/dbi.rb:318:
> >
> > 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.
> >
> > Regards
> > Mark
> >
> > _______________________________________________
> > rspec-users mailing list
> > rspec-users at rubyforge.org
> > http://rubyforge.org/mailman/listinfo/rspec-users
> >
> >
>
>


More information about the rspec-users mailing list