1

I want to load portion of the database. When I run integration tests. But with controller and model tests I want to skip it and clean between every test. So the problem is that it currently cleans the database in the integration tests but I want to prevent that. How do I do that?

user3384741
  • 1,261
  • 3
  • 16
  • 21

1 Answers1

1

If you have DatabaseCleaner in the before/after hooks, you could do it only for non feature specs as below:

config.before(:each) do |example|
    DatabaseCleaner.start unless example.metadata[:js]
end

config.after(:each) do |example| do
    DatabaseCleaner.clean unless example.metadata[:js]
end

This may lead to odd behaviour though if you run the full suite in a random order.

RichardAE
  • 2,945
  • 1
  • 17
  • 20