Frederick Cheung wrote:
> On Jun 15, 8:23�am, nico Itkin <[email protected]>
> wrote:
>>
>> > So what exactly happens �when you run rake ?
>>
>> > Fred
>>
>> When I run ruby unit/status_test.rb �: everything is fine, constants are
>> all present
>>
>> When I run rake test:units �: no constant is set, as if constant_cache
>> hasn't been run
>>
> Did you stick a breakpoint in constant_cache ? I rather suspect that
> it is running but that the particular sequence of actions that takes
> place means that it happens before fixtures have been loaded.
> When you run rake the test database is recreated from scratch and so
> starts of empty (and then fixtures are loaded).
> When you run a single test file then the test database isn't recreated
> and so the fixtures are already there.
> 
> Your setup method probably runs after fixtures have been loaded, but
> all it does is call require and that file was already required earlier
> on when rails loaded your initializers so those requires may well be
> no-ops.
> 
> Fred

Thanks Fred for your help,

I guess you're right, do you know a nice way to force constant_cache to 
be run before each test ?

Otherwise I think i'll try to prevent rake to prepare db before running 
tests, but i'm not sure this is an optimal solution to my pb.

Itkin
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to