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
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 Andrew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20091205/8da80b8e/attachment-0001.html>
Thanks Andrew, That was the right hint. I took the autospec command list of all specs and ran them in smaller groups - which led to discovering a Declarative Auth config switch that was heretofore isolated. Apparently in the new version of this gem it does not get reset between tests. Once I removed those WMD''s of auth control all my tests returned to normal. Another lesson learned, muchas gracias. regards, Andy On Dec 5, 2:11?am, Andrew Premdas <aprem... at gmail.com> wrote:> 2009/12/4 Andy Koch <andy.k... 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-us... 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 > > Andrew > > _______________________________________________ > rspec-users mailing list > rspec-us... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/rspec-users