Sha256: 4c779be192d4f1e7776ec84a3aae6f568d9be2b38cd2c9ecbfe39459e073d7eb

Contents?: true

Size: 990 Bytes

Versions: 14

Compression:

Stored size: 990 Bytes

Contents

require_relative '../../test_helper'

class TransitionWithInvalidNodesTest < StateMachinesTest
  def setup
    @klass = Class.new
    @machine = StateMachines::Machine.new(@klass)
    @machine.state :parked, :idling
    @machine.event :ignite

    @object = @klass.new
    @object.state = 'parked'
  end

  def test_should_raise_exception_without_event
    assert_raises(IndexError) { StateMachines::Transition.new(@object, @machine, nil, :parked, :idling) }
  end

  def test_should_raise_exception_with_invalid_event
    assert_raises(IndexError) { StateMachines::Transition.new(@object, @machine, :invalid, :parked, :idling) }
  end

  def test_should_raise_exception_with_invalid_from_state
    assert_raises(IndexError) { StateMachines::Transition.new(@object, @machine, :ignite, :invalid, :idling) }
  end

  def test_should_raise_exception_with_invalid_to_state
    assert_raises(IndexError) { StateMachines::Transition.new(@object, @machine, :ignite, :parked, :invalid) }
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

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