Module: Dynflow::Testing::Assertions
- Included in:
 - Dynflow::Testing
 
- Defined in:
 - lib/dynflow/testing/assertions.rb
 
Instance Method Summary collapse
- 
  
    
      #assert_action_planned(action, planned_action_class)  ⇒ Object 
    
    
      (also: #assert_action_planed)
    
  
  
  
  
  
  
  
  
  
    
assert that
assert_actioned_planwas planned byaction. - 
  
    
      #assert_action_planned_with(action, planned_action_class, *plan_input, &block)  ⇒ Object 
    
    
      (also: #assert_action_planed_with)
    
  
  
  
  
  
  
  
  
  
    
assert that
assert_actioned_planwas planned byactionwith argumentsplan_inputalternatively plan-input can be asserted withblock. - 
  
    
      #assert_finalize_phase(action)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
assert that
actionhas finalize-phase planned. - 
  
    
      #assert_run_phase(action, input = nil, &block)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
assert that
actionhas run-phase planned. - #refute_action_planned(action, planned_action_class) ⇒ Object (also: #refute_action_planed)
 - 
  
    
      #refute_finalize_phase(action)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
refute that
actionhas finalize-phase planned. - 
  
    
      #refute_run_phase(action)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
refute that
actionhas run-phase planned. 
Instance Method Details
#assert_action_planned(action, planned_action_class) ⇒ Object Also known as: assert_action_planed
assert that assert_actioned_plan was planned by action
      25 26 27 28 29 30 31 32 33  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 25 def assert_action_planned(action, planned_action_class) Match! action.phase, Action::Plan Match! action.state, :success found = action.execution_plan.planned_plan_steps .select { |a| a.is_a?(planned_action_class) } assert(!found.empty?, "Action #{planned_action_class} was not planned") found end  | 
  
#assert_action_planned_with(action, planned_action_class, *plan_input, &block) ⇒ Object Also known as: assert_action_planed_with
assert that assert_actioned_plan was planned by action with arguments plan_input alternatively plan-input can be asserted with block
      8 9 10 11 12 13 14 15 16 17 18 19 20 21 22  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 8 def assert_action_planned_with(action, planned_action_class, *plan_input, &block) found_classes = assert_action_planned(action, planned_action_class) found = found_classes.select do |a| if plan_input.empty? block.call a.plan_input else a.plan_input == plan_input end end assert(!found.empty?, "Action #{planned_action_class} with plan_input #{plan_input} was not planned, " + "there were only #{found_classes.map(&:plan_input)}") found end  | 
  
#assert_finalize_phase(action) ⇒ Object
assert that action has finalize-phase planned
      66 67 68 69 70  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 66 def assert_finalize_phase(action) Match! action.phase, Action::Plan Match! action.state, :success _(action.execution_plan.planned_finalize_steps).must_include action end  | 
  
#assert_run_phase(action, input = nil, &block) ⇒ Object
assert that action has run-phase planned
      50 51 52 53 54 55 56  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 50 def assert_run_phase(action, input = nil, &block) Match! action.phase, Action::Plan Match! action.state, :success _(action.execution_plan.planned_run_steps).must_include action _(action.input).must_equal Utils.stringify_keys(input) if input block.call action.input if block end  | 
  
#refute_action_planned(action, planned_action_class) ⇒ Object Also known as: refute_action_planed
      35 36 37 38 39 40 41 42 43  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 35 def refute_action_planned(action, planned_action_class) Match! action.phase, Action::Plan Match! action.state, :success found = action.execution_plan.planned_plan_steps .select { |a| a.is_a?(planned_action_class) } assert(found.empty?, "Action #{planned_action_class} was planned") found end  | 
  
#refute_finalize_phase(action) ⇒ Object
refute that action has finalize-phase planned
      73 74 75 76 77  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 73 def refute_finalize_phase(action) Match! action.phase, Action::Plan Match! action.state, :success _(action.execution_plan.planned_finalize_steps).wont_include action end  | 
  
#refute_run_phase(action) ⇒ Object
refute that action has run-phase planned
      59 60 61 62 63  | 
    
      # File 'lib/dynflow/testing/assertions.rb', line 59 def refute_run_phase(action) Match! action.phase, Action::Plan Match! action.state, :success _(action.execution_plan.planned_run_steps).wont_include action end  |