class CallbackTest

Public Instance Methods

test_should_not_bind_to_objects() click to toggle source
# File test/unit/callback_test.rb, line 46
def test_should_not_bind_to_objects
  assert !StateMachine::Callback.bind_to_object
end
test_should_not_have_a_terminator() click to toggle source
# File test/unit/callback_test.rb, line 50
def test_should_not_have_a_terminator
  assert_nil StateMachine::Callback.terminator
end
test_should_not_raise_exception_if_implicit_option_specified() click to toggle source
# File test/unit/callback_test.rb, line 42
def test_should_not_raise_exception_if_implicit_option_specified
  assert_nothing_raised { StateMachine::Callback.new(:before, :do => :run, :invalid => :valid) }
end
test_should_not_raise_exception_if_method_specified_as_argument() click to toggle source
# File test/unit/callback_test.rb, line 34
def test_should_not_raise_exception_if_method_specified_as_argument
  assert_nothing_raised { StateMachine::Callback.new(:before, :run) }
end
test_should_not_raise_exception_if_method_specified_as_block() click to toggle source
# File test/unit/callback_test.rb, line 38
def test_should_not_raise_exception_if_method_specified_as_block
  assert_nothing_raised { StateMachine::Callback.new(:before, :run) {} }
end
test_should_not_raise_exception_if_method_specified_in_do_option() click to toggle source
# File test/unit/callback_test.rb, line 30
def test_should_not_raise_exception_if_method_specified_in_do_option
  assert_nothing_raised { StateMachine::Callback.new(:before, :do => :run) }
end
test_should_not_raise_exception_if_using_after_type() click to toggle source
# File test/unit/callback_test.rb, line 13
def test_should_not_raise_exception_if_using_after_type
  assert_nothing_raised { StateMachine::Callback.new(:after) {} }
end
test_should_not_raise_exception_if_using_around_type() click to toggle source
# File test/unit/callback_test.rb, line 17
def test_should_not_raise_exception_if_using_around_type
  assert_nothing_raised { StateMachine::Callback.new(:around) {} }
end
test_should_not_raise_exception_if_using_before_type() click to toggle source
# File test/unit/callback_test.rb, line 9
def test_should_not_raise_exception_if_using_before_type
  assert_nothing_raised { StateMachine::Callback.new(:before) {} }
end
test_should_not_raise_exception_if_using_failure_type() click to toggle source
# File test/unit/callback_test.rb, line 21
def test_should_not_raise_exception_if_using_failure_type
  assert_nothing_raised { StateMachine::Callback.new(:failure) {} }
end
test_should_raise_exception_if_invalid_type_specified() click to toggle source
# File test/unit/callback_test.rb, line 4
def test_should_raise_exception_if_invalid_type_specified
  exception = assert_raise(ArgumentError) { StateMachine::Callback.new(:invalid) {} }
  assert_equal 'Type must be :before, :after, :around, or :failure', exception.message
end
test_should_raise_exception_if_no_methods_specified() click to toggle source
# File test/unit/callback_test.rb, line 25
def test_should_raise_exception_if_no_methods_specified
  exception = assert_raise(ArgumentError) { StateMachine::Callback.new(:before) }
  assert_equal 'Method(s) for callback must be specified', exception.message
end