module Lopata::ActiveRecord::DSL

To be included in Lopata::ScenarioBuilder. The methods may be used in build time.

Public Instance Methods

cleanup(*vars, &block) click to toggle source

Mark instance variables to call destroy at teardown phase of scenario or context running.

Does nothing if 'keep' mode is enabled.

@param vars [Array<Symbol, String>] instance variable names to be destroyed on teardown phase.

# File lib/lopata/active_record.rb, line 116
def cleanup(*vars, &block)
  unless vars.empty?
    teardown do
      cleanup vars.map { |v| instance_variable_get "@#{v}" }
    end
  end
  teardown &block if block_given?
end