class VehicleWithEventAttributesTest

Public Instance Methods

setup() click to toggle source
# File test/functional/state_machine_test.rb, line 792
def setup
  @vehicle = Vehicle.new
  @vehicle.state_event = 'ignite'
end
test_should_fail_if_event_has_no_transition() click to toggle source
# File test/functional/state_machine_test.rb, line 803
def test_should_fail_if_event_has_no_transition
  @vehicle.state_event = 'park'
  assert !@vehicle.save
  assert_equal 'parked', @vehicle.state
end
test_should_fail_if_event_is_invalid() click to toggle source
# File test/functional/state_machine_test.rb, line 797
def test_should_fail_if_event_is_invalid
  @vehicle.state_event = 'invalid'
  assert !@vehicle.save
  assert_equal 'parked', @vehicle.state
end
test_should_return_original_action_value_on_success() click to toggle source
# File test/functional/state_machine_test.rb, line 809
def test_should_return_original_action_value_on_success
  assert_equal @vehicle, @vehicle.save
end
test_should_transition_state_on_success() click to toggle source
# File test/functional/state_machine_test.rb, line 813
def test_should_transition_state_on_success
  @vehicle.save
  assert_equal 'idling', @vehicle.state
end