Module: Cucumber::StepMethods

Defined in:
lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb

Overview

Defines “global” methods that may be used in *_steps.rb files.

Instance Method Summary collapse

Instance Method Details

#After(&proc) ⇒ Object



15
16
17
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 15

def After(&proc)
  executor.register_after_scenario_proc(&proc)
end

#AfterStep(&proc) ⇒ Object



19
20
21
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 19

def AfterStep(&proc)
  executor.register_after_step_proc(&proc)
end

#Before(&proc) ⇒ Object



11
12
13
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 11

def Before(&proc)
  executor.register_before_scenario_proc(&proc)
end

#executorObject



45
46
47
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 45

def executor
  @executor ||= Executor.new(step_mother)
end

#Given(key, &proc) ⇒ Object



23
24
25
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 23

def Given(key, &proc)
  step_mother.register_step_proc(key, &proc)
end

#step_motherObject

:nodoc:



41
42
43
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 41

def step_mother #:nodoc:
  @step_mother ||= StepMother.new
end

#steps_for(*_) ⇒ Object

Simple workaround for old skool steps



36
37
38
39
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 36

def steps_for(*_)
  STDERR.puts "WARNING: In Cucumber the steps_for method is obsolete"
  yield
end

#Then(key, &proc) ⇒ Object



31
32
33
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 31

def Then(key, &proc)
  step_mother.register_step_proc(key, &proc)
end

#When(key, &proc) ⇒ Object



27
28
29
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 27

def When(key, &proc)
  step_mother.register_step_proc(key, &proc)
end

#World(&proc) ⇒ Object

Each scenario will execute in the context of what the supplied block returns.



7
8
9
# File 'lib/gems/cucumber-0.1.15/lib/cucumber/step_methods.rb', line 7

def World(&proc)
  executor.register_world_proc(&proc)
end