Sha256: f874145f86e563cd48e2558dedfcfb7c2612ef49187c5848102e18d69d2d8a7f

Contents?: true

Size: 875 Bytes

Versions: 14

Compression:

Stored size: 875 Bytes

Contents

require_relative '../../test_helper'

class TransitionCollectionWithSkippedActionsAndBlockTest < StateMachinesTest
  def setup
    @klass = Class.new

    @machine = StateMachines::Machine.new(@klass, initial: :parked, action: :save_state)
    @machine.state :idling
    @machine.event :ignite

    @object = @klass.new

    @transitions = StateMachines::TransitionCollection.new([
      @state_transition = StateMachines::Transition.new(@object, @machine, :ignite, :parked, :idling)
    ], actions: false)
    @result = @transitions.perform { @ran_block = true; 1 }
  end

  def test_should_succeed
    assert_equal 1, @result
  end

  def test_should_persist_states
    assert_equal 'idling', @object.state
  end

  def test_should_run_block
    assert @ran_block
  end

  def test_should_store_results_in_transitions
    assert_equal 1, @state_transition.result
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
state_machines-0.5.0 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/state_machines-0.2.2/test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.4.0 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.3.0 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.2.2 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.2.1 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.2.0 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.1.4 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.1.3 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.1.2 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.1.1 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb
state_machines-0.1.0 test/unit/transition_collection/transition_collection_with_skipped_actions_and_block_test.rb