summaryrefslogtreecommitdiff
path: root/spec/ruby/core/hash/value_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/hash/value_spec.rb')
-rw-r--r--spec/ruby/core/hash/value_spec.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/spec/ruby/core/hash/value_spec.rb b/spec/ruby/core/hash/value_spec.rb
index 9cfbe576d2..8e4732480f 100644
--- a/spec/ruby/core/hash/value_spec.rb
+++ b/spec/ruby/core/hash/value_spec.rb
@@ -1,7 +1,16 @@
require_relative '../../spec_helper'
describe "Hash#value?" do
- it "is an alias of Hash#has_value?" do
- Hash.instance_method(:value?).should == Hash.instance_method(:has_value?)
+ it "returns true if the value exists in the hash" do
+ { a: :b }.value?(:a).should == false
+ { 1 => 2 }.value?(2).should == true
+ h = Hash.new(5)
+ h.value?(5).should == false
+ h = Hash.new { 5 }
+ h.value?(5).should == false
+ end
+
+ it "uses == semantics for comparing values" do
+ { 5 => 2.0 }.value?(2).should == true
end
end