ruby on rails - Tell Rspec - don't delete my test_db when before running tests -
i populate database want run rspec tests against.
rspec seems delete db before starts tests. how can tell rspec not delete test_db?
i populate db outside of rails / rspec environment. build factories needed build db not practical scope of project test against existing db.
you can manage clean database using database cleaner gem, , documentation recommends following configuration rspec link, change following:
rspec.configure |config| config.before(:suite) databasecleaner.strategy = :transaction databasecleaner.clean_with(:truncation) end end
but, prefer create database in test environment before scenario, example:
describe "specific name scenario" before @object = create(:object) # using factory girl example end end
so, data'll generate each time run test-case, read more creating data rspec-test.
Comments
Post a Comment