class ErrorWithMessageTest
Public Instance Methods
setup()
click to toggle source
# File test/unit/error_test.rb, line 24 def setup @machine = StateMachine::Machine.new(Class.new) @collection = StateMachine::NodeCollection.new(@machine) end
test_should_raise_exception_if_invalid_option_specified()
click to toggle source
# File test/unit/error_test.rb, line 29 def test_should_raise_exception_if_invalid_option_specified exception = assert_raise(ArgumentError) { StateMachine::NodeCollection.new(@machine, :invalid => true) } assert_equal 'Invalid key(s): invalid', exception.message end
test_should_raise_exception_on_fetch_if_invalid_index_specified()
click to toggle source
# File test/unit/error_test.rb, line 39 def test_should_raise_exception_on_fetch_if_invalid_index_specified exception = assert_raise(ArgumentError) { @collection.fetch(:something, :invalid) } assert_equal 'Invalid index: :invalid', exception.message end
test_should_raise_exception_on_lookup_if_invalid_index_specified()
click to toggle source
# File test/unit/error_test.rb, line 34 def test_should_raise_exception_on_lookup_if_invalid_index_specified exception = assert_raise(ArgumentError) { @collection[:something, :invalid] } assert_equal 'Invalid index: :invalid', exception.message end