class CallbackWithTerminatorTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/callback_test.rb, line 324 def setup @object = Object.new end
test_should_halt_if_terminator_matches()
click to toggle source
# File test/unit/callback_test.rb, line 333 def test_should_halt_if_terminator_matches callback = StateMachine::Callback.new(:before, :do => lambda {false}, :terminator => lambda {|result| result == false}) assert_throws(:halt) { callback.call(@object) } end
test_should_halt_if_terminator_matches_any_method()
click to toggle source
# File test/unit/callback_test.rb, line 338 def test_should_halt_if_terminator_matches_any_method callback = StateMachine::Callback.new(:before, :do => [lambda {true}, lambda {false}], :terminator => lambda {|result| result == 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 328 def test_should_not_halt_if_terminator_does_not_match callback = StateMachine::Callback.new(:before, :do => lambda {false}, :terminator => lambda {|result| result == true}) assert_nothing_thrown { callback.call(@object) } end