diff options
author | Pratik Naik <pratiknaik@gmail.com> | 2009-03-20 10:32:24 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-20 10:32:24 +0000 |
commit | 5b1a1bf5bfc520248285b036672146122dd2a815 (patch) | |
tree | 31d82a9155db6c9e553888da6375bd89fdb122cf /activemodel/test/state_machine/machine_test.rb | |
parent | 93e2d378df5f599e3e48e74932f37e1c679f633e (diff) | |
download | rails-5b1a1bf5bfc520248285b036672146122dd2a815.tar.gz rails-5b1a1bf5bfc520248285b036672146122dd2a815.tar.bz2 rails-5b1a1bf5bfc520248285b036672146122dd2a815.zip |
Make Active Model test suite similar to Active Record
Diffstat (limited to 'activemodel/test/state_machine/machine_test.rb')
-rw-r--r-- | activemodel/test/state_machine/machine_test.rb | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/activemodel/test/state_machine/machine_test.rb b/activemodel/test/state_machine/machine_test.rb deleted file mode 100644 index d23c223160..0000000000 --- a/activemodel/test/state_machine/machine_test.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'test_helper' - -class MachineTestSubject - include ActiveModel::StateMachine - - state_machine do - state :open - state :closed - end - - state_machine :initial => :foo do - event :shutdown do - transitions :from => :open, :to => :closed - end - - event :timeout do - transitions :from => :open, :to => :closed - end - end - - state_machine :extra, :initial => :bar do - end -end - -class StateMachineMachineTest < ActiveModel::TestCase - test "allows reuse of existing machines" do - assert_equal 2, MachineTestSubject.state_machines.size - end - - test "sets #initial_state from :initial option" do - assert_equal :bar, MachineTestSubject.state_machine(:extra).initial_state - end - - test "accesses non-default state machine" do - assert_kind_of ActiveModel::StateMachine::Machine, MachineTestSubject.state_machine(:extra) - end - - test "finds events for given state" do - events = MachineTestSubject.state_machine.events_for(:open) - assert events.include?(:shutdown) - assert events.include?(:timeout) - end -end |