Sha256: e7aca9746ddbadfc389b432818bcc00623db7e12b5ebe99e352683de3251cc89
Contents?: true
Size: 845 Bytes
Versions: 7
Compression:
Stored size: 845 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 /Cannot transition to default from running for `TestEventBeingFired::AnotherDummy/, 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
7 entries across 7 versions & 1 rubygems