Module: Cucumber::StepMother::WorldMethods

Defined in:
lib/cucumber/step_mother.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__cucumber_current_step=(value) ⇒ Object (writeonly)

Sets the attribute __cucumber_current_step

Parameters:

  • value

    the value to set the attribute __cucumber_current_step to.



158
159
160
# File 'lib/cucumber/step_mother.rb', line 158

def __cucumber_current_step=(value)
  @__cucumber_current_step = value
end

#__cucumber_step_mother=(value) ⇒ Object (writeonly)

Sets the attribute __cucumber_step_mother

Parameters:

  • value

    the value to set the attribute __cucumber_step_mother to.



158
159
160
# File 'lib/cucumber/step_mother.rb', line 158

def __cucumber_step_mother=(value)
  @__cucumber_step_mother = value
end

Instance Method Details

#__cucumber_invoke(name, *multiline_arguments) ⇒ Object

Call a step from within a step definition



161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/cucumber/step_mother.rb', line 161

def __cucumber_invoke(name, *multiline_arguments)
  begin
    # TODO: Very similar to code in Step. Refactor. Get back StepInvocation?
    # Make more similar to JBehave?
    step_definition = @__cucumber_step_mother.step_definition(name)
    matched_args = step_definition.matched_args(name)
    args = (matched_args + multiline_arguments)
    step_definition.execute(name, self, *args)
  rescue Exception => e
    @__cucumber_current_step.exception = e
    raise e
  end
end

#pending(message = "TODO") ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/cucumber/step_mother.rb', line 180

def pending(message = "TODO")
  if block_given?
    begin
      yield
    rescue Exception => e
      raise Pending.new(message)
    end
    raise Pending.new("Expected pending '#{message}' to fail. No Error was raised. No longer pending?")
  else
    raise Pending.new(message)
  end
end

#table(text, file = nil, line = 0) ⇒ Object



175
176
177
178
# File 'lib/cucumber/step_mother.rb', line 175

def table(text, file=nil, line=0)
  @table_parser ||= Parser::TableParser.new
  @table_parser.parse_or_fail(text.strip, file, line)
end