Okay - I'm stumped: is there a way to run unit tests without blowing
away data preloaded into the test database?

Details: our system uses a TimeDimension table -- think of it as a
datetime that's been highly decorated with additional info, such as
whether or not it's a holiday and other dimensional database goodness.
Many of our unit tests depend on the presence of the TimeDimension
table, but with ~21K rows it's too expensive to recompute before every
test.

I *thought* that seeds.rb could be used to pre-populate the db before
running unit tests, but I traced through "rake test:units" and it
appears to blow away existing data before running the tests.

For example, the following does NOT work:

  bash$ export RAILS_ENV=test  # work with test db
  bash$ rake db:reset    # drop, recreate, seed test db
  bash$ rake test:units    # blows away the seeds before running (ugh)

So: Is there a way to load persistent data into tables that won't get
nuked running unit tests?  (To make it perfectly clear: rollbacks after
each test are fine, its just the initial clearing of the database that I
want to avoid.)

Ideas?  Am I missing some obvious rake command or option?

- ff

btw:

bash$ rails --version ; rake --version ; ruby --version
Rails 2.3.8
rake, version 0.8.7
ruby 1.9.1p376 (2009-12-07 revision 26041) [powerpc-darwin9.8.0]
-- 
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