I have two unit tests that works fine if I run them individually. ex: ruby test/unit/company_test.rb Loaded suite test/unit/company_test Started ... Finished in 0.037888 seconds. 3 tests, 7 assertions, 0 failures, 0 errors However, if I run ''rake test:units'' the same test as above fails with: 1) Failure: test_state(CompanyTest) [./test/unit/company_test.rb:26]: <false> is not true. My test is: def test_state # .... company = companies(:test_company) assert company.valid? end Why would it work from ruby and not rake? I have one other test that fails the same way. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Check what fixtures are being included in the tests. I''ve run into a lot of the same problems as this, and it''s always been that I wasn''t including a fixture properly. Jason On 9/28/07, gobigdave <gobigdave-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > I have two unit tests that works fine if I run them individually. > > ex: ruby test/unit/company_test.rb > Loaded suite test/unit/company_test > Started > ... > Finished in 0.037888 seconds. > > 3 tests, 7 assertions, 0 failures, 0 errors > > However, if I run ''rake test:units'' the same test as above fails with: > 1) Failure: > test_state(CompanyTest) [./test/unit/company_test.rb:26]: > <false> is not true. > > My test is: > def test_state > # .... > company = companies(:test_company) > assert company.valid? > end > > Why would it work from ruby and not rake? I have one other test that > fails the same way. > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks. The issue seemed to be with one of the validations. I was validating against a table of states using the two letter state abbr. as a FK. When I took that validation out, the test worked in both instances. In both cases, I loaded the fixture containing all the state data. Feels to me like there might be a bug lurking in here somewhere because the test should have worked in both cases. On Sep 28, 2:35 pm, "Jason Roelofs" <jameskil...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Check what fixtures are being included in the tests. I''ve run into a lot of > the same problems as this, and it''s always been that I wasn''t including a > fixture properly. > > Jason > > On 9/28/07, gobigdave <gobigd...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I have two unit tests that works fine if I run them individually. > > > ex: ruby test/unit/company_test.rb > > Loaded suite test/unit/company_test > > Started > > ... > > Finished in 0.037888 seconds. > > > 3 tests, 7 assertions, 0 failures, 0 errors > > > However, if I run ''rake test:units'' the same test as above fails with: > > 1) Failure: > > test_state(CompanyTest) [./test/unit/company_test.rb:26]: > > <false> is not true. > > > My test is: > > def test_state > > # .... > > company = companies(:test_company) > > assert company.valid? > > end > > > Why would it work from ruby and not rake? I have one other test that > > fails the same way.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---