class CallbackWithApplicationTerminatorTest

Public Instance Methods

setup() click to toggle source
# File test/unit/callback_test.rb, line 487
def setup
  @original_terminator = StateMachine::Callback.bind_to_object
  StateMachine::Callback.terminator = lambda {|result| result == false}
  
  @object = Object.new
end
teardown() click to toggle source
# File test/unit/callback_test.rb, line 504
def teardown
  StateMachine::Callback.bind_to_object = @original_bind_to_object
end
test_should_halt_if_terminator_matches() click to toggle source
# File test/unit/callback_test.rb, line 499
def test_should_halt_if_terminator_matches
  callback = StateMachine::Callback.new(:before, :do => lambda {false})
  assert_throws(:halt) { callback.call(@object) }
end
test_should_not_halt_if_terminator_does_not_match() click to toggle source
# File test/unit/callback_test.rb, line 494
def test_should_not_halt_if_terminator_does_not_match
  callback = StateMachine::Callback.new(:before, :do => lambda {true})
  assert_nothing_thrown { callback.call(@object) }
end