class CallbackWithImplicitRequirementsTest

Public Instance Methods

setup() click to toggle source
# File test/unit/callback_test.rb, line 250
def setup
  @object = Object.new
  @callback = StateMachine::Callback.new(:before, :parked => :idling, :on => :ignite, :do => lambda {})
end
test_should_call_if_all_requirements_met() click to toggle source
# File test/unit/callback_test.rb, line 271
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 255
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 275
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 259
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 267
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 263
def test_should_not_call_if_to_not_included
  assert !@callback.call(@object, :to => :parked)
end