Fearless Fool wrote:
> The documentation on fixtures makes a tantalizing claim:
> 
> | If you preload your test database with all fixture data 
> | (probably in the Rakefile task) and use transactional 
> | fixtures, then you may omit all fixtures declarations 
> | in your test cases since all the data’s already there 
> | and every case rolls back its changes. 
> 
> Yup!  That's exactly what I want: I have some LARGE constant tables that
> are used pervasively, so I want to load them ONCE and exploit the
> efficiency of transactional fixtures thereafter. 

No you don't.  You don't need all the large constant table data to run 
your tests.

Besides, as you already know, fixtures are crap.  What you want to do is 
use factories to craft exactly the data you need for each individual 
unit test.  This will normally only be a few records at a time.

> I know I can preload
> the test database from fixtures like this:
> 
> % rake db:fixtures:load RAILS_ENV=test
> 
> But then how do I run unit tests while preserving my carefully preloaded
> data?

You don't.  Good test isolation *requires* clearing the database for 
every test.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
[email protected]
-- 
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