Class: ScenarioContext
- Inherits:
-
Object
- Object
- ScenarioContext
- Defined in:
- lib/scenario_context.rb,
lib/scenario_context/version.rb,
lib/scenario_context/scenario_proxy.rb
Overview
A class that holds useful debug information from a Scenario or Scenario Outline
Defined Under Namespace
Classes: ScenarioProxy
Constant Summary collapse
- VERSION =
The version of the scenario_context gem
'1.0.0'
Instance Attribute Summary collapse
-
#scenario ⇒ Object
Returns the value of attribute scenario.
Instance Method Summary collapse
-
#initialize(scenario) ⇒ ScenarioContext
constructor
A new instance of ScenarioContext.
-
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
True if the method is available or whether @scenario responds to the method.
Constructor Details
#initialize(scenario) ⇒ ScenarioContext
Returns a new instance of ScenarioContext.
10 11 12 |
# File 'lib/scenario_context.rb', line 10 def initialize(scenario) @scenario = ScenarioProxy.new(scenario) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object (private)
Returns the return value of the method after sending it to @scenario.
40 41 42 43 44 45 46 47 48 |
# 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 |
Instance Attribute Details
#scenario ⇒ Object
Returns the value of attribute scenario.
8 9 10 |
# File 'lib/scenario_context.rb', line 8 def scenario @scenario end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Returns true if the method is available or whether @scenario responds to the method.
31 32 33 |
# 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 |