iewnait
iewnait

Reputation: 238

Rake cucumber in Rails without dropping Database

Running Cucumber Test in rails seems to by default drop and recreate Test database.

Was wondering if there is anywhere to not drop and recreate Test database during each test?

Using: Rails 3.1 cucumber 1.1.o cucumber-rails 1.1.1

Command used: Rake cucumber

Upvotes: 2

Views: 621

Answers (1)

Josh Crews
Josh Crews

Reputation: 799

Cucumber does reset the test database after each scenario. That's normally what you want, but sometimes you might want some persistent data that never gets reset. If thats your case, you can modify how database_cleaner works in features/support/env.rb

Look for

DatabaseCleaner.strategy = :transaction

and replace it with your version of

DatabaseCleaner.strategy = :truncation, {:except => %w[directions locations]}

Where "directions locations" are the names of the tables you don't want cleared out ever.

Upvotes: 4

Related Questions