Module: Cucumber::LanguageSupport::LanguageMethods

Included in:
RbSupport::RbLanguage
Defined in:
lib/cucumber/language_support/language_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_hook(phase, hook) ⇒ Object



26
27
28
29
# File 'lib/cucumber/language_support/language_methods.rb', line 26

def add_hook(phase, hook)
  hooks[phase.to_sym] << hook
  hook
end

#add_step_definition(step_definition) ⇒ Object



31
32
33
34
# File 'lib/cucumber/language_support/language_methods.rb', line 31

def add_step_definition(step_definition)
  step_definitions << step_definition
  step_definition
end

#after(scenario) ⇒ Object



9
10
11
12
# File 'lib/cucumber/language_support/language_methods.rb', line 9

def after(scenario)
  execute_after(scenario)
  end_scenario
end

#after_configuration(configuration) ⇒ Object



14
15
16
17
18
# File 'lib/cucumber/language_support/language_methods.rb', line 14

def after_configuration(configuration)
  hooks[:after_configuration].each do |hook|
    hook.invoke('AfterConfiguration', configuration)
  end
end

#before(scenario) ⇒ Object



4
5
6
7
# File 'lib/cucumber/language_support/language_methods.rb', line 4

def before(scenario)
  begin_scenario
  execute_before(scenario)
end

#execute_after_step(scenario) ⇒ Object



20
21
22
23
24
# File 'lib/cucumber/language_support/language_methods.rb', line 20

def execute_after_step(scenario)
  hooks_for(:after_step, scenario).each do |hook|
    invoke(hook, 'AfterStep', scenario, false)
  end
end

#hooks_for(phase, scenario) ⇒ Object

:nodoc:



40
41
42
# File 'lib/cucumber/language_support/language_methods.rb', line 40

def hooks_for(phase, scenario) #:nodoc:
  hooks[phase.to_sym].select{|hook| scenario.accept_hook?(hook)}
end

#step_definitionsObject



36
37
38
# File 'lib/cucumber/language_support/language_methods.rb', line 36

def step_definitions
  @step_definitions ||= []
end