Class: Dynflow::Testing::DummyExecutionPlan
- Inherits:
-
Object
- Object
- Dynflow::Testing::DummyExecutionPlan
- Extended by:
- Mimic
- Defined in:
- lib/dynflow/testing/dummy_execution_plan.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#planned_finalize_steps ⇒ Object
readonly
Returns the value of attribute planned_finalize_steps.
-
#planned_plan_steps ⇒ Object
readonly
Returns the value of attribute planned_plan_steps.
-
#planned_run_steps ⇒ Object
readonly
Returns the value of attribute planned_run_steps.
Instance Method Summary collapse
- #add_finalize_step(action) ⇒ Object
- #add_plan_step(klass, _) ⇒ Object
- #add_run_step(action) ⇒ Object
- #dummy_planned_action(klass) ⇒ Object
-
#initialize ⇒ DummyExecutionPlan
constructor
A new instance of DummyExecutionPlan.
-
#stub_planned_action(klass, &block) ⇒ Object
Allows modify the DummyPlannedAction returned by plan_action.
- #switch_flow(*args, &block) ⇒ Object
- #world ⇒ Object
Methods included from Mimic
Constructor Details
#initialize ⇒ DummyExecutionPlan
Returns a new instance of DummyExecutionPlan.
10 11 12 13 14 15 16 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 10 def initialize @id = Testing.get_id.to_s @planned_plan_steps = [] @planned_run_steps = [] @planned_finalize_steps = [] @planned_action_stubbers = {} end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 8 def id @id end |
#planned_finalize_steps ⇒ Object (readonly)
Returns the value of attribute planned_finalize_steps.
8 9 10 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 8 def planned_finalize_steps @planned_finalize_steps end |
#planned_plan_steps ⇒ Object (readonly)
Returns the value of attribute planned_plan_steps.
8 9 10 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 8 def planned_plan_steps @planned_plan_steps end |
#planned_run_steps ⇒ Object (readonly)
Returns the value of attribute planned_run_steps.
8 9 10 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 8 def planned_run_steps @planned_run_steps end |
Instance Method Details
#add_finalize_step(action) ⇒ Object
38 39 40 41 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 38 def add_finalize_step(action) @planned_finalize_steps << action action end |
#add_plan_step(klass, _) ⇒ Object
27 28 29 30 31 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 27 def add_plan_step(klass, _) dummy_planned_action(klass).tap do |action| @planned_plan_steps << action end end |
#add_run_step(action) ⇒ Object
33 34 35 36 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 33 def add_run_step(action) @planned_run_steps << action action end |
#dummy_planned_action(klass) ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 43 def dummy_planned_action(klass) DummyPlannedAction.new(klass).tap do |action| if planned_action_stubber = @planned_action_stubbers[klass] planned_action_stubber.call(action) end end end |
#stub_planned_action(klass, &block) ⇒ Object
Allows modify the DummyPlannedAction returned by plan_action
23 24 25 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 23 def stub_planned_action(klass, &block) @planned_action_stubbers[klass] = block end |
#switch_flow(*args, &block) ⇒ Object
51 52 53 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 51 def switch_flow(*args, &block) block.call end |
#world ⇒ Object
18 19 20 |
# File 'lib/dynflow/testing/dummy_execution_plan.rb', line 18 def world @world ||= DummyWorld.new end |