Sha256: 190b70e2116ecbd6811048d59216418d91ec0e84eba4b39c6300dca3f0675218
Contents?: true
Size: 749 Bytes
Versions: 3
Compression:
Stored size: 749 Bytes
Contents
require "spec_helper" describe Hash do let(:hash) { {foo: 1, bar: 2, baz: 3, qux: 4} } describe "#map_values" do subject(:map_values) { hash.map_values {|arg| arg * 2 } } specify { expect(map_values).to eq({foo: 2, bar: 4, baz: 6, qux: 8}) } specify { expect{|block| hash.map_values(&block) }.to yield_successive_args(1, 2, 3, 4) } specify { expect{ map_values }.to_not change{ hash } } end describe "#map_values!" do subject(:map_values!) { hash.map_values! {|arg| arg * 2 } } specify { expect(map_values!).to eq({foo: 2, bar: 4, baz: 6, qux: 8}) } specify { expect{|block| hash.map_values!(&block) }.to yield_successive_args(1, 2, 3, 4) } specify { expect{ map_values! }.to change{ hash } } end end
Version data entries
3 entries across 3 versions & 1 rubygems