On Tue, Jul 22, 2008 at 1:56 PM, Macario Ortega <[EMAIL PROTECTED]> wrote: > > Well I don't trust autotest because the same tests pass when i run them > from textmate and they fail when I run autotest. > > The dubbious specs are all for a specific model but some of them are > very basic such as testing validates_presence_of in which the model code > is obviously good and yet the spec fails on rake or autotest.
I've had this happen before, and it turned out to be a state problem. Things I did in one spec file were altering the state of the application, so that spec files run after it would fail in certain ways. Thus, passing or failing was entirely dependent on the *order* the files were run in. Rake runs things in a different order than autotest, so different tests were failing; and running a single file by itself always passed. In my case the state change was stupid and totally unnecessary. At the time I didn't really understand mocking and stubbing, so I was trying to bypass my authentication code in my specs by reopening the authentication modules in lib/ and overriding the live logged_in? method to return 'true'. This worked, but I didn't realize the overrides would continue to be in place for all future specs. And quite naturally, some of the specs for restful_authentication were failing. I wasted hours figuring that one out. The moral I learned was, don't EVER try to screw with your actual application code in a spec, and make sure that nothing you do in a spec leaves a permanent change in memory. I can't know if that's your problem, of course, but it's something to think about. -- Have Fun, Steve Eley Deep Salt Team _______________________________________________ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users