equal_rights_for_hash 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = "equal_rights_for_hash"
4
- s.version = "0.0.3"
4
+ s.version = "0.0.4"
5
5
  s.authors = ["Suraj N. Kurapati"]
6
6
  s.email = ["sunaku@gmail.com"]
7
7
  s.homepage = "http://redmine.ruby-lang.org/issues/5008"
@@ -1,6 +1,8 @@
1
1
  module Kernel
2
2
  def Hash(value)
3
3
  value.to_h
4
+ rescue
5
+ raise ArgumentError, "invalid value for Hash(): #{value.inspect}"
4
6
  end
5
7
  end
6
8
 
@@ -26,4 +26,9 @@ class TestKernelHash < Test::Unit::TestCase
26
26
  def test_converts_empty_array_into_hash
27
27
  assert_equal({}, Hash([]))
28
28
  end
29
+
30
+ def test_raises_ArgumentError_on_failure
31
+ error = assert_raise(ArgumentError) { Hash("bogus") }
32
+ assert_equal('invalid value for Hash(): "bogus"', error.message)
33
+ end
29
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: equal_rights_for_hash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: