Dynflow/dynflow — pull request #104 by iNecas (2014-03-06 21:20:15+00:00)
Title: DummyExecutionPlan.stub_planned_action

Sometimes, there is a need to simulate some behavior of sub action's plan
method. `DummyExecutionPlan.stub_planned_action` allows to register a block
that gets run when DummyPlannedAction is instanciated. This allows to extend
this dummy action to simulate the real behavior, to properly test the plan
method in isolation.

One of the examples might be something like:

```ruby def plan
sub_action = plan_action(SubAction, 123)
plan_action(AnotherSubAction, sub_action.input[:message]) end
```

Outside of testing, the sub_action.input gets filled by the SubAction#plan
method. However, since in tests we don't run the plan methods of sub actions,
we need another mechanism to simulate this.

Therefore, in tests, one can now do something like:

```ruby action = create_action(MyAction)
action.execution_plan.stub_planned_action(SubAction) do |sub_action|
sub_action.stubs(input: { message: 123 }) end
```