diff --git a/lib/echo_common/rspec/helpers/db_clean_helper.rb b/lib/echo_common/rspec/helpers/db_clean_helper.rb index bd8b500..8b6b96d 100644 --- a/lib/echo_common/rspec/helpers/db_clean_helper.rb +++ b/lib/echo_common/rspec/helpers/db_clean_helper.rb @@ -10,12 +10,13 @@ module DbCleanHelper def self.included(base) base.class_eval do around(:each) do |example| - if example.metadata[:omit_database_transaction] + DatabaseCleaner.strategy = if example.metadata[:omit_database_transaction] + :truncation + else + :transaction + end + DatabaseCleaner.cleaning do example.run - else - DatabaseCleaner.cleaning do - example.run - end end end end