class InvalidTransitionTest

Public Instance Methods

setup() click to toggle source
# File test/unit/invalid_transition_test.rb, line 4
def setup
  @klass = Class.new
  @machine = StateMachine::Machine.new(@klass)
  @state = @machine.state :parked
  @machine.event :ignite
  
  @object = @klass.new
  @object.state = 'parked'
  
  @invalid_transition = StateMachine::InvalidTransition.new(@object, @machine, :ignite)
end
test_should_generate_a_message() click to toggle source
# File test/unit/invalid_transition_test.rb, line 44
def test_should_generate_a_message
  assert_equal 'Cannot transition state via :ignite from :parked', @invalid_transition.message
end
test_should_have_a_from_name() click to toggle source
# File test/unit/invalid_transition_test.rb, line 36
def test_should_have_a_from_name
  assert_equal :parked, @invalid_transition.from_name
end
test_should_have_a_from_value() click to toggle source
# File test/unit/invalid_transition_test.rb, line 32
def test_should_have_a_from_value
  assert_equal 'parked', @invalid_transition.from
end
test_should_have_a_machine() click to toggle source
# File test/unit/invalid_transition_test.rb, line 20
def test_should_have_a_machine
  assert_equal @machine, @invalid_transition.machine
end
test_should_have_a_qualified_event() click to toggle source
# File test/unit/invalid_transition_test.rb, line 28
def test_should_have_a_qualified_event
  assert_equal :ignite, @invalid_transition.qualified_event
end
test_should_have_a_qualified_from_name() click to toggle source
# File test/unit/invalid_transition_test.rb, line 40
def test_should_have_a_qualified_from_name
  assert_equal :parked, @invalid_transition.qualified_from_name
end
test_should_have_an_event() click to toggle source
# File test/unit/invalid_transition_test.rb, line 24
def test_should_have_an_event
  assert_equal :ignite, @invalid_transition.event
end
test_should_have_an_object() click to toggle source
# File test/unit/invalid_transition_test.rb, line 16
def test_should_have_an_object
  assert_equal @object, @invalid_transition.object
end