Class: MachineCollectionFireImplicitPartialWithCallbacksTest
- Inherits:
-
MachineCollectionFireImplicitTest
- Object
- Test::Unit::TestCase
- MachineCollectionFireImplicitTest
- MachineCollectionFireImplicitPartialWithCallbacksTest
- Defined in:
- lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb
Instance Method Summary collapse
- #setup ⇒ Object
- #test_should_not_have_event_during_after_callbacks ⇒ Object
- #test_should_not_have_event_during_before_callbacks ⇒ Object
- #test_should_not_have_event_transition_during_after_callbacks ⇒ Object
- #test_should_not_have_event_transition_during_before_callbacks ⇒ Object
- #test_should_not_run_after_callbacks ⇒ Object
- #test_should_run_before_callbacks ⇒ Object
Methods inherited from MachineCollectionFireImplicitTest
Instance Method Details
#setup ⇒ Object
631 632 633 634 635 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 631 def setup super @object.state_event = 'ignite' end |
#test_should_not_have_event_during_after_callbacks ⇒ Object
669 670 671 672 673 674 675 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 669 def test_should_not_have_event_during_after_callbacks state_event = nil @machine.after_transition {|object, transition| state_event = object.state_event } @machines.fire_event_attributes(@object, :save, false) { true } assert_nil state_event end |
#test_should_not_have_event_during_before_callbacks ⇒ Object
645 646 647 648 649 650 651 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 645 def test_should_not_have_event_during_before_callbacks state_event = nil @machine.before_transition {|object, transition| state_event = object.state_event } @machines.fire_event_attributes(@object, :save, false) { true } assert_nil state_event end |
#test_should_not_have_event_transition_during_after_callbacks ⇒ Object
677 678 679 680 681 682 683 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 677 def test_should_not_have_event_transition_during_after_callbacks state_event_transition = nil @machine.after_transition {|object, transition| state_event_transition = object.send(:state_event_transition) } @machines.fire_event_attributes(@object, :save, false) { true } assert_nil state_event_transition end |
#test_should_not_have_event_transition_during_before_callbacks ⇒ Object
653 654 655 656 657 658 659 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 653 def test_should_not_have_event_transition_during_before_callbacks state_event_transition = nil @machine.before_transition {|object, transition| state_event_transition = object.send(:state_event_transition) } @machines.fire_event_attributes(@object, :save, false) { true } assert_nil state_event_transition end |
#test_should_not_run_after_callbacks ⇒ Object
661 662 663 664 665 666 667 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 661 def test_should_not_run_after_callbacks ran_callback = false @machine.after_transition { ran_callback = true } @machines.fire_event_attributes(@object, :save, false) { true } assert !ran_callback end |
#test_should_run_before_callbacks ⇒ Object
637 638 639 640 641 642 643 |
# File 'lib/branston/vendor/plugins/state_machine/test/unit/machine_collection_test.rb', line 637 def test_should_run_before_callbacks ran_callback = false @machine.before_transition { ran_callback = true } @machines.fire_event_attributes(@object, :save, false) { true } assert ran_callback end |