class TransitionEqualityTest

Public Instance Methods

setup() click to toggle source
# File test/unit/transition_test.rb, line 1493
def setup
  @klass = Class.new
  
  @machine = StateMachine::Machine.new(@klass)
  @machine.state :parked, :idling
  @machine.event :ignite
  
  @object = @klass.new
  @object.state = 'parked'
  @transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
end
test_should_be_equal_with_same_properties() click to toggle source
# File test/unit/transition_test.rb, line 1505
def test_should_be_equal_with_same_properties
  transition = StateMachine::Transition.new(@object, @machine, :ignite, :parked, :idling)
  assert_equal transition, @transition
end
test_should_not_be_equal_with_different_event_names() click to toggle source
# File test/unit/transition_test.rb, line 1524
def test_should_not_be_equal_with_different_event_names
  @machine.event :park
  transition = StateMachine::Transition.new(@object, @machine, :park, :parked, :idling)
  assert_not_equal transition, @transition
end
test_should_not_be_equal_with_different_from_state_names() click to toggle source
# File test/unit/transition_test.rb, line 1530
def test_should_not_be_equal_with_different_from_state_names
  @machine.state :first_gear
  transition = StateMachine::Transition.new(@object, @machine, :ignite, :first_gear, :idling)
  assert_not_equal transition, @transition
end
test_should_not_be_equal_with_different_machines() click to toggle source
# File test/unit/transition_test.rb, line 1510
def test_should_not_be_equal_with_different_machines
  machine = StateMachine::Machine.new(@klass, :status, :namespace => :other)
  machine.state :parked, :idling
  machine.event :ignite
  transition = StateMachine::Transition.new(@object, machine, :ignite, :parked, :idling)
  
  assert_not_equal transition, @transition
end
test_should_not_be_equal_with_different_objects() click to toggle source
# File test/unit/transition_test.rb, line 1519
def test_should_not_be_equal_with_different_objects
  transition = StateMachine::Transition.new(@klass.new, @machine, :ignite, :parked, :idling)
  assert_not_equal transition, @transition
end
test_should_not_be_equal_with_different_to_state_names() click to toggle source
# File test/unit/transition_test.rb, line 1536
def test_should_not_be_equal_with_different_to_state_names
  @machine.state :first_gear
  transition = StateMachine::Transition.new(@object, @machine, :ignite, :idling, :first_gear)
  assert_not_equal transition, @transition
end