Sha256: 5261cdc16b58a25d85fbb0f2e602f6b235606fcc7e221572f865f67e24f1b7ce
Contents?: true
Size: 855 Bytes
Versions: 14
Compression:
Stored size: 855 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
14 entries across 14 versions & 1 rubygems