class Dynflow::Testing::DummyExecutionPlan

Attributes

id[R]
planned_finalize_steps[R]
planned_plan_steps[R]
planned_run_steps[R]

Public Class Methods

new() click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 11
def initialize
  @id                       = Testing.get_id.to_s
  @planned_plan_steps       = []
  @planned_run_steps        = []
  @planned_finalize_steps   = []
  @planned_action_stubbers  = {}
end

Public Instance Methods

add_finalize_step(action) click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 39
def add_finalize_step(action)
  @planned_finalize_steps << action
  action
end
add_plan_step(klass, _) click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 28
def add_plan_step(klass, _)
  dummy_planned_action(klass).tap do |action|
    @planned_plan_steps << action
  end
end
add_run_step(action) click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 34
def add_run_step(action)
  @planned_run_steps << action
  action
end
dummy_planned_action(klass) click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 44
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) click to toggle source

Allows modify the DummyPlannedAction returned by plan_action

# File lib/dynflow/testing/dummy_execution_plan.rb, line 24
def stub_planned_action(klass, &block)
  @planned_action_stubbers[klass] = block
end
switch_flow(*args, &block) click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 52
def switch_flow(*args, &block)
  block.call
end
world() click to toggle source
# File lib/dynflow/testing/dummy_execution_plan.rb, line 19
def world
  @world ||= DummyWorld.new
end