Sha256: 98b2e246600a009fcb9cdc771a01161ed4c45795ffbbf8c69549f176cbfd11f1

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 KB

Contents

RSpec.configure do |config|

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

  config.before(:each) do
    if ActiveRecord::Base.connection.adapter_name =~ /sqlite/i
      #Rails.logger.debug "Setting cleaning strategy to truncation: sqlite"
      DatabaseCleaner.strategy = :truncation # sqlite3 doesn't support nested transactions :transaction
    elsif ActiveRecord::Base.connection.adapter_name =~ /postgres/i
      DatabaseCleaner.strategy = :truncation # sqlite3 doesn't support nested transactions :transaction
    else
      #Rails.logger.debug "Setting cleaning strategy to transaction(activerecord)"
      DatabaseCleaner.strategy = :transaction # assume a transactional database (we're using active_record)
      #DatabaseCleaner.strategy = :truncation # assume a transactional database (we're using active_record)
    end
  end

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

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

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

  config.after(:each) do
    DatabaseCleaner.clean
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mail_manager-3.2.25.1 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.22.0 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.7 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.6 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.5 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.4 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.2 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.1 spec/test_app/spec/support/database_cleaner.rb
mail_manager-3.2.0 spec/test_app/spec/support/database_cleaner.rb