class CallbackWithIfConditionTest

Public Instance Methods

setup() click to toggle source
# File test/unit/callback_test.rb, line 281
def setup
  @object = Object.new
end
test_should_call_if_true() click to toggle source
# File test/unit/callback_test.rb, line 285
def test_should_call_if_true
  callback = StateMachine::Callback.new(:before, :if => lambda {true}, :do => lambda {})
  assert callback.call(@object)
end
test_should_not_call_if_false() click to toggle source
# File test/unit/callback_test.rb, line 290
def test_should_not_call_if_false
  callback = StateMachine::Callback.new(:before, :if => lambda {false}, :do => lambda {})
  assert !callback.call(@object)
end