class EventWithMarshallingTest
Public Instance Methods
save()
click to toggle source
# File test/unit/event_test.rb, line 943 def save true end
setup()
click to toggle source
# File test/unit/event_test.rb, line 941 def setup @klass = Class.new do def save true end end self.class.const_set('Example', @klass) @machine = StateMachine::Machine.new(@klass, :action => :save) @machine.state :parked, :idling @machine.events << @event = StateMachine::Event.new(@machine, :ignite) @event.transition(:parked => :idling) @object = @klass.new @object.state = 'parked' end
teardown()
click to toggle source
# File test/unit/event_test.rb, line 979 def teardown self.class.send(:remove_const, 'Example') end
test_should_marshal_during_action()
click to toggle source
# File test/unit/event_test.rb, line 964 def test_should_marshal_during_action @klass.class_eval do def save Marshal.dump(self) end end assert_nothing_raised { @event.fire(@object) } end
test_should_marshal_during_after_callbacks()
click to toggle source
# File test/unit/event_test.rb, line 974 def test_should_marshal_during_after_callbacks @machine.after_transition {|object, transition| Marshal.dump(object)} assert_nothing_raised { @event.fire(@object) } end
test_should_marshal_during_before_callbacks()
click to toggle source
# File test/unit/event_test.rb, line 959 def test_should_marshal_during_before_callbacks @machine.before_transition {|object, transition| Marshal.dump(object)} assert_nothing_raised { @event.fire(@object) } end