Class: Cucumber::Runtime::SupportCode::StepInvoker

Inherits:
Object
  • Object
show all
Defined in:
lib/cucumber/runtime/support_code.rb

Instance Method Summary collapse

Constructor Details

#initialize(support_code) ⇒ StepInvoker


16
17
18
# File 'lib/cucumber/runtime/support_code.rb', line 16

def initialize(support_code)
  @support_code = support_code
end

Instance Method Details

#multiline_arg(step, location) ⇒ Object


29
30
31
32
33
34
35
36
37
# File 'lib/cucumber/runtime/support_code.rb', line 29

def multiline_arg(step, location)
  if !step[:doc_string].nil?
    MultilineArgument.from(step[:doc_string][:content], location, step[:doc_string][:content_type])
  elsif !step[:data_table].nil?
    MultilineArgument::DataTable.from(step[:data_table][:rows].map { |row| row[:cells].map { |cell| cell[:value] } })
  else
    MultilineArgument.from(nil)
  end
end

#step(step) ⇒ Object


24
25
26
27
# File 'lib/cucumber/runtime/support_code.rb', line 24

def step(step)
  location = Core::Test::Location.of_caller
  @support_code.invoke_dynamic_step(step[:text], multiline_arg(step, location))
end

#steps(steps) ⇒ Object


20
21
22
# File 'lib/cucumber/runtime/support_code.rb', line 20

def steps(steps)
  steps.each { |step| step(step) }
end