diff options
Diffstat (limited to 'spec/ruby/core/hash/transform_values_spec.rb')
-rw-r--r-- | spec/ruby/core/hash/transform_values_spec.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/spec/ruby/core/hash/transform_values_spec.rb b/spec/ruby/core/hash/transform_values_spec.rb index 0c9e43d621..a9098a9f2d 100644 --- a/spec/ruby/core/hash/transform_values_spec.rb +++ b/spec/ruby/core/hash/transform_values_spec.rb @@ -16,6 +16,13 @@ ruby_version_is "2.4" do @hash.transform_values(&:succ).should == { a: 2, b: 3, c: 4 } end + it "makes both hashes to share keys" do + key = [1, 2, 3] + new_hash = { key => 1 }.transform_values(&:succ) + new_hash[key].should == 2 + new_hash.keys[0].should equal(key) + end + context "when no block is given" do it "returns a sized Enumerator" do enumerator = @hash.transform_values @@ -47,7 +54,7 @@ ruby_version_is "2.4" do it "updates self as transformed values with the given block" do @hash.transform_values!(&:succ) - @hash.should == { a: 2, b: 3, c: 4 } + @hash.should == { a: 2, b: 3, c: 4 } end it "partially modifies the contents if we broke from the block" do |