diff options
author | rick <technoweenie@gmail.com> | 2008-06-28 11:01:40 -0700 |
---|---|---|
committer | rick <technoweenie@gmail.com> | 2008-06-28 11:01:40 -0700 |
commit | a9d9ca16c739ec39a192d29c62f760e51040fc6e (patch) | |
tree | d425cb2a79d947f9cce89819e02f2ce8b98c8c73 /activemodel/test/state_machine | |
parent | 74cb05698684f237a7eb91afadec0020d8910c70 (diff) | |
download | rails-a9d9ca16c739ec39a192d29c62f760e51040fc6e.tar.gz rails-a9d9ca16c739ec39a192d29c62f760e51040fc6e.tar.bz2 rails-a9d9ca16c739ec39a192d29c62f760e51040fc6e.zip |
converted tests for more complex state transitions
Diffstat (limited to 'activemodel/test/state_machine')
-rw-r--r-- | activemodel/test/state_machine/event_test.rb | 6 | ||||
-rw-r--r-- | activemodel/test/state_machine/machine_test.rb | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/activemodel/test/state_machine/event_test.rb b/activemodel/test/state_machine/event_test.rb index 01f3464cf2..7db4f8d887 100644 --- a/activemodel/test/state_machine/event_test.rb +++ b/activemodel/test/state_machine/event_test.rb @@ -7,7 +7,7 @@ class EventTest < ActiveModel::TestCase end def new_event - @event = ActiveModel::StateMachine::Event.new(@name, {:success => @success}) do + @event = ActiveModel::StateMachine::Event.new(nil, @name, {:success => @success}) do transitions :to => :closed, :from => [:open, :received] end end @@ -31,7 +31,7 @@ end class EventBeingFiredTest < ActiveModel::TestCase test 'should raise an AASM::InvalidTransition error if the transitions are empty' do - event = ActiveModel::StateMachine::Event.new(:event) + event = ActiveModel::StateMachine::Event.new(nil, :event) assert_raises ActiveModel::StateMachine::InvalidTransition do event.fire(nil) @@ -39,7 +39,7 @@ class EventBeingFiredTest < ActiveModel::TestCase end test 'should return the state of the first matching transition it finds' do - event = ActiveModel::StateMachine::Event.new(:event) do + event = ActiveModel::StateMachine::Event.new(nil, :event) do transitions :to => :closed, :from => [:open, :received] end diff --git a/activemodel/test/state_machine/machine_test.rb b/activemodel/test/state_machine/machine_test.rb index 64dea42b1f..2cdfcd9554 100644 --- a/activemodel/test/state_machine/machine_test.rb +++ b/activemodel/test/state_machine/machine_test.rb @@ -36,6 +36,8 @@ class StateMachineMachineTest < ActiveModel::TestCase end test "finds events for given state" do - assert_equal [:shutdown, :timeout], MachineTestSubject.state_machine.events_for(:open) + events = MachineTestSubject.state_machine.events_for(:open) + assert events.include?(:shutdown) + assert events.include?(:timeout) end end
\ No newline at end of file |