Sha256: f8f777593fdff426a7c5874be8e5952126b5849b3e9f6793b1f16b7efbad606e
Contents?: true
Size: 856 Bytes
Versions: 2
Compression:
Stored size: 856 Bytes
Contents
require "helper" class TestEventBeingFired < Test::Unit::TestCase test "should raise an Transitions::InvalidTransition error if the transitions are empty" do event = Transitions::Event.new(nil, :event) class AnotherDummy; end obj = AnotherDummy.new obj.stubs(:current_state).returns(:running) exception = assert_raise Transitions::InvalidTransition do event.fire(obj) end assert_match /No transitions present for `TestEventBeingFired::AnotherDummy` with current state `running`/, exception.message end test "should return the state of the first matching transition it finds" do event = Transitions::Event.new(nil, :event) do transitions :to => :closed, :from => [:open, :received] end obj = stub obj.stubs(:current_state).returns(:open) assert_equal :closed, event.fire(obj) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
transitions-0.0.16 | test/test_event_being_fired.rb |
transitions-0.0.14 | test/test_event_being_fired.rb |