Permalink
Browse files

raise ArgumentError to reflect current MRI impl

  • Loading branch information...
1 parent 411578d commit ab10c5232452f54aa3c88d7520e9169327f92824 @sunaku committed Sep 27, 2011
Showing with 4 additions and 4 deletions.
  1. +1 −1 lib/equal_rights_for_hash.rb
  2. +3 −3 test/kernel_hash_test.rb
@@ -2,7 +2,7 @@ module Kernel
def Hash(value)
value.to_h
rescue
- raise TypeError, "invalid value for Hash: #{value}"
+ raise ArgumentError, "invalid value for Hash(): #{value.inspect}"
end
end
View
@@ -27,8 +27,8 @@ def test_converts_empty_array_into_hash
assert_equal({}, Hash([]))
end
- def test_raises_TypeError_on_failure
- error = assert_raise(TypeError) { Hash("bogus") }
- assert_equal("invalid value for Hash: bogus", error.message)
+ def test_raises_ArgumentError_on_failure
+ error = assert_raise(ArgumentError) { Hash("bogus") }
+ assert_equal('invalid value for Hash(): "bogus"', error.message)
end
end

0 comments on commit ab10c52

Please sign in to comment.