class CallbackWithExplicitRequirementsTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/callback_test.rb, line 219 def setup @object = Object.new @callback = StateMachine::Callback.new(:before, :from => :parked, :to => :idling, :on => :ignite, :do => lambda {}) end
test_should_call_if_all_requirements_met()
click to toggle source
# File test/unit/callback_test.rb, line 240 def test_should_call_if_all_requirements_met assert @callback.call(@object, :from => :parked, :to => :idling, :on => :ignite) end
test_should_call_with_empty_context()
click to toggle source
# File test/unit/callback_test.rb, line 224 def test_should_call_with_empty_context assert @callback.call(@object, {}) end
test_should_include_in_known_states()
click to toggle source
# File test/unit/callback_test.rb, line 244 def test_should_include_in_known_states assert_equal [:parked, :idling], @callback.known_states end
test_should_not_call_if_from_not_included()
click to toggle source
# File test/unit/callback_test.rb, line 228 def test_should_not_call_if_from_not_included assert !@callback.call(@object, :from => :idling) end
test_should_not_call_if_on_not_included()
click to toggle source
# File test/unit/callback_test.rb, line 236 def test_should_not_call_if_on_not_included assert !@callback.call(@object, :on => :park) end
test_should_not_call_if_to_not_included()
click to toggle source
# File test/unit/callback_test.rb, line 232 def test_should_not_call_if_to_not_included assert !@callback.call(@object, :to => :parked) end