Class: Context
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Context
- Defined in:
- lib/contextual/context.rb
Overview
The Context is used to pass information between different stages of a Test. Context is inherited from parent to child, but not sibling to sibling. The Context object is an OpenStruct, which means you can dynamically assign as needed.
Instance Attribute Summary collapse
-
#actual ⇒ Object
Actual expected object, ideally will be set during the Contexual::Node#run_action step.
-
#expected ⇒ Object
Expected.
Instance Method Summary collapse
- #apply(parent_context) ⇒ Object
-
#initialize ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize ⇒ Context
Returns a new instance of Context.
17 18 19 20 21 |
# File 'lib/contextual/context.rb', line 17 def initialize super @expected = nil @actual = nil end |
Instance Attribute Details
#actual ⇒ Object
Returns actual expected object, ideally will be set during the Contexual::Node#run_action step.
12 13 14 |
# File 'lib/contextual/context.rb', line 12 def actual @actual end |
#expected ⇒ Object
Returns expected.
15 16 17 |
# File 'lib/contextual/context.rb', line 15 def expected @expected end |
Instance Method Details
#apply(parent_context) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/contextual/context.rb', line 24 def apply(parent_context) @expected = parent_context.expected @actual = parent_context.actual parent_context.each_pair do |key, value| self[key] = value end end |