[rspec-users] [rspec-rails] spec vs. autospec
apremdas at gmail.com
Sat Dec 5 05:11:26 EST 2009
2009/12/4 Andy Koch <andy.koch at pc-doctor.com>
> Hi All,
> any reason why some tests might pass via spec ... and fail from within
> I have a rails app using AuthLogic and Declarative Authorization. I
> have tests that create user_sessions and assign roles against which
> CRUD rules are tested.
> This has bee working just fine.
> But this morning I updated the Declarative Auth gem and suddenly
> started seeing failing tests. I immediately blamed DA, or really my
> usage of it. But then I started running the spec files individually
> via "spec ..." commands and everything started passing - which was
> actually more disturbing for me.
> so now I wonder what autospec might be doing that is different from
> straight "spec ..." commands?
> when I run "rake spec" they fail just like in autospec - there's some
> comforting consistency, failing tests notwithstanding.
> thanks for any insights
> rspec-users mailing list
> rspec-users at rubyforge.org
Generally this indicates a problem with one spec interfering with another.
Run separately the specs run fine, because the state is completely reset
between each run. However run together (and this can be order dependent,
just to add to the confusion) and they break. Debugging this can be quite
tricky, monitoring the test database, and the test.log should help. However
generally I find that you just have to pay real close attention to any specs
that create any sort of permanent artifact, and any specs that rely on there
being a certain number of artifacts e.g. the first role.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rspec-users