[rspec-users] [rspec-rails] spec vs. autospec

Andrew Premdas 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
> autospec?
> 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
> http://rubyforge.org/mailman/listinfo/rspec-users

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.

All best

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091205/8da80b8e/attachment-0001.html>

More information about the rspec-users mailing list