I have several database tables that have data that is for display purposes only, it never changes. It takes a long time to load all the seed data. I am using cucumber which seems to use the database_cleaner gem before each scenario to truncate all the tables in the test db. Is there a way to tell database_cleaner or cucumber to leave a few tables alone or am i stuck with loading my seed data before every scenario? I am running rails 2.3.8 cucumber 0.10.0 cucumber-rails 0.3.2 database_cleaner 0.50.0 Any help is much appreciated. Tom
If you are using ActiveRecord
or DataMapper
you should be able to use the :transaction
strategy instead of :truncation
.
DatabaseCleaner.strategy = :transaction
Or as @traday points out, you can use an exclusion list with truncation.
DatabaseCleaner.strategy = :truncation, {:except => %w[widgets]}
The DatabaseCleaner docs are worth reading. Look in features/support/env.rb
for where this is typically set up with Cucumber.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With