Module: Cucumber::Rails::Database

Defined in:
lib/cucumber/rails/database.rb

Defined Under Namespace

Classes: DeletionStrategy, InvalidStrategy, SharedConnectionStrategy, Strategy, TruncationStrategy

Constant Summary

CUSTOM_STRATEGY_INTERFACE =
%w{ before_js before_non_js }

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.autorun_database_cleanerObject

Returns the value of attribute autorun_database_cleaner



9
10
11
# File 'lib/cucumber/rails/database.rb', line 9

def autorun_database_cleaner
  @autorun_database_cleaner
end

Class Method Details

.afterObject



34
35
36
# File 'lib/cucumber/rails/database.rb', line 34

def after
  @strategy.after
end

.before_jsObject



26
27
28
# File 'lib/cucumber/rails/database.rb', line 26

def before_js
  @strategy.before_js
end

.before_non_jsObject



30
31
32
# File 'lib/cucumber/rails/database.rb', line 30

def before_non_js
  @strategy.before_non_js
end

.javascript_strategy=(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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