class ScenarioContext

A class that holds useful debug information from a Scenario or Scenario Outline

A class that holds useful debug information from a Scenario or Scenario Outline

A class that holds useful debug information from a Scenario or Scenario Outline

Constants

ScenarioProxy

A generic interface to a Scenario or ExampleRow

VERSION

The version of the scenario_context gem

Attributes

scenario[R]

@!attribute [r] scenario

@return [Scenario,ExampleRow]

Public Class Methods

new(scenario) click to toggle source
# File lib/scenario_context.rb, line 10
def initialize(scenario)
  @scenario = ScenarioProxy.new(scenario)
end

Public Instance Methods

respond_to_missing?(method_name, include_private = false) click to toggle source

@return [Boolean] true if the method is available or whether @scenario

responds to the method
Calls superclass method
# File lib/scenario_context.rb, line 31
def respond_to_missing?(method_name, include_private = false)
  super || scenario.respond_to?(method_name, include_private) || original_scenario.respond_to?(method_name, include_private)
end
scenario=(scenario) click to toggle source

Sets @scenario as the scenario/outline wrapped in a proxy object

@param [Scenario,ExampleRow,ScenarioProxy] scenario the scenario to

set @scenario to

@return [ScenarioProxy] a scenario proxy object that holds the scenario or

scenario outline
# File lib/scenario_context.rb, line 20
def scenario=(scenario)
  @scenario =
    if scenario.is_a?(ScenarioProxy)
      scenario
    else
      ScenarioProxy.new(scenario)
    end
end

Private Instance Methods

method_missing(method_name, *args, &block) click to toggle source

@raise [NoMethodError] if @scenario could not respond to the missing

method

@return the return value of the method after sending it to @scenario

Calls superclass method
# File lib/scenario_context.rb, line 40
def method_missing(method_name, *args, &block)
  if scenario.respond_to?(method_name)
    scenario.send(method_name, *args, &block)
  elsif original_scenario.respond_to?(method_name)
    original_scenario.send(method_name, *args, &block)
  else
    super
  end
end
original_scenario() click to toggle source

@return the native ExampleRow or Scenario object

# File lib/scenario_context.rb, line 51
def original_scenario
  scenario.scenario
end