Sha256: ef063ef427c257d3f821c78aac4172e4b90f46a2117568f77fdf4951ac0c9445
Contents?: true
Size: 844 Bytes
Versions: 2
Compression:
Stored size: 844 Bytes
Contents
require 'helper' class Car include Transitions state_machine do state :parked state :driving state :switched_off event :start_driving do transitions from: :parked, to: :driving end event :switch_off_engine do transitions from: :parked, to: :switched_off end end end class TestStateTransitionEventFailedCallback < Test::Unit::TestCase def setup @car = Car.new end test "should execute the event_failed_callback and don't raise error if callback is defined" do @car.start_driving @car.expects(:event_failed).with(:switch_off_engine) @car.switch_off_engine end test "should just re-raise any error on transition if the event_failed_callback isn't defined" do @car.start_driving assert_raise(Transitions::InvalidTransition) { @car.switch_off_engine } end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transitions-1.0.0 | test/state_transition/test_state_transition_event_failed_callback.rb |
transitions-0.2.1 | test/state_transition/test_state_transition_event_failed_callback.rb |