Alan Bullock
2006-Jul-17 21:38 UTC
[Rails] functional tests run fine on their own but fail with rake
this is a weird one. i have 8 functional tests classes. when I run them individually, they all pass. When i use rake or ''rake test:functionals'' one of them fails. I''ve traced the error back to a problemwith reading data from the session. when running the tests individually, the data is there. when run using rake, it''s nil. has anyone come across anything like this before? any suggestions? thanks alan
Chris T
2006-Jul-17 22:21 UTC
[Rails] functional tests run fine on their own but fail with rake
Alan Bullock wrote:> this is a weird one. i have 8 functional tests classes. when I run them > individually, they all pass. When i use rake or ''rake test:functionals'' one > of them fails. I''ve traced the error back to a problemwith reading data from > the session. > > when running the tests individually, the data is there. when run using rake, > it''s nil. > > has anyone come across anything like this before? any suggestions? > > thanks > alan > > > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >This has usually something to do with fixtures and associations, I think. There was a thread about this about 3 weeks ago, or so. If you search for functional, fixtures rake, I think you''ll prob find something. HTH
Kelly Felkins
2006-Jul-18 20:12 UTC
[Rails] functional tests run fine on their own but fail with rake
Yes I''ve seen this and it is maddening. When I was on the brink of something terrible, I tried to calm myself and think of the differences in the 2 situations. One difference I came up with, like mentioned above by Chris T, is the handling of fixtures. When you do "rake", in some or all of the situations the schema is recreated by copying from the development schema. This is not done if you simply invoke a test on its own. The result is the database state can be slightly different. Specifically, a test running manually may find records in the database that would be deleted if the schema were recreated. In my case, close inspection revealed that one my tests referenced records that were *not* added by the test specified fixtures. When I added the missing fixture my tests started operating the same in both environments. -Kelly On 7/17/06, Chris T <ctmailinglists@googlemail.com> wrote:> > Alan Bullock wrote: > > this is a weird one. i have 8 functional tests classes. when I run them > > individually, they all pass. When i use rake or ''rake test:functionals'' > one > > of them fails. I''ve traced the error back to a problemwith reading data > from > > the session. > > > > when running the tests individually, the data is there. when run using > rake, > > it''s nil. > > > > has anyone come across anything like this before? any suggestions? > > > > thanks > > alan > > > > > > > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > This has usually something to do with fixtures and associations, I > think. There was a thread about this about 3 weeks ago, or so. If you > search for functional, fixtures rake, I think you''ll prob find something. > > HTH > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060718/9e7c72ce/attachment.html
cremes.devlist@mac.com
2006-Jul-19 18:35 UTC
[Rails] functional tests run fine on their own but fail with rake
On Jul 18, 2006, at 3:12 PM, Kelly Felkins wrote:> Yes I''ve seen this and it is maddening. When I was on the brink of > something terrible, I tried to calm myself and think of the > differences in the 2 situations. One difference I came up with, > like mentioned above by Chris T, is the handling of fixtures. > > When you do "rake", in some or all of the situations the schema is > recreated by copying from the development schema.Also, check your config/environment.rb file and verify the line: config.active_record.schema_format = :sql If it is set to output the schema as ruby, then all sorts of weird things can go wrong. I haven''t found a good reason yet to override the default of sql. cr