# File lib/cucumber/rails/database.rb, line 26 def before_js @strategy.before_js end
# File lib/cucumber/rails/database.rb, line 30 def before_non_js @strategy.before_non_js end
# File lib/cucumber/rails/database.rb, line 11 def javascript_strategy=(args) strategy, *strategy_opts = args strategy_type = case strategy when Symbol map[strategy] || raise(InvalidStrategy, "The strategy '#{strategy}' is not understood. Please use one of #{map.keys.join(',')}") when Class strategy end @strategy = strategy_type.new(*strategy_opts) validate_interface! end
# File lib/cucumber/rails/database.rb, line 36 def map { :truncation => TruncationStrategy, :shared_connection => SharedConnectionStrategy, :transaction => SharedConnectionStrategy, :deletion => DeletionStrategy } end
# File lib/cucumber/rails/database.rb, line 45 def validate_interface! unless CUSTOM_STRATEGY_INTERFACE.all? {|m| @strategy.respond_to?(m) } raise(ArgumentError, "Strategy must respond to all of: #{CUSTOM_STRATEGY_INTERFACE.map{|method| "##{method}" } * ' '} !") end end