treble37
2/3/2015 - 5:51 AM

Step 2 - Testing ElasticSearch - database_cleaner.rb

Step 2 - Testing ElasticSearch - database_cleaner.rb

RSpec.configure do |config|

  #config.before(:suite) do
  #  DatabaseCleaner.clean_with(:truncation)
  #end

  #config.before(:each) do
  #  DatabaseCleaner.strategy = :transaction
  #end

  #config.before(:each, :js => true) do
  #  DatabaseCleaner.strategy = :truncation
  #end

  #config.before(:each) do
  #  DatabaseCleaner.start
  #end

  #config.after(:eache) do
  #  DatabaseCleaner.clean
  #end

  config.before(:suite) do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with(:truncation)
  end
 
  config.around(:each) do |example|
    DatabaseCleaner.strategy = example.metadata[:commit] ? :truncation : :transaction
    DatabaseCleaner.cleaning do
      example.run
    end
  end

end