module DatabaseRewinder::Compatibility

Public Instance Methods

[](orm = nil, connection: nil, **) click to toggle source

In order to add another database to cleanup, you can give its connection name in one of the forms below:

# the simplest form
DatabaseRewinder['the_db_name']

or

# with connection: key
DatabaseRewinder[connection: 'the_db_name']

or

# DatabaseCleaner compatible
DatabaseRewinder[:active_record, connection: 'the_db_name']

You can cleanup multiple databases for each test using this configuration.

Calls superclass method
# File lib/database_rewinder/compatibility.rb, line 39
def [](orm = nil, connection: nil, **)
  if connection.nil?
    if orm.is_a? String
      connection = orm
    elsif orm.is_a?(Hash) && orm.key?(:connection)
      connection = orm[:connection]
    end
  end
  super connection
end
clean_with(*args, **opts) click to toggle source
# File lib/database_rewinder/compatibility.rb, line 5
def clean_with(*args, **opts)
  cleaners.each {|c| c.clean_with(*args, **opts)}
end
cleaning() { || ... } click to toggle source
# File lib/database_rewinder/compatibility.rb, line 9
def cleaning
  yield
ensure
  clean
end
start() click to toggle source
# File lib/database_rewinder/compatibility.rb, line 15
def start; end
strategy=(args) click to toggle source
# File lib/database_rewinder/compatibility.rb, line 17
def strategy=(args)
  options = args.is_a?(Array) ? args.extract_options! : {}
  @only, @except = options[:only], options[:except]
  cleaners.each {|c| c.strategy = nil, options}
end