Sha256: c78a07efac2cf248e758fa6d080e01fd20eef85ccc2b01d1530ddc1ed352ecd7
Contents?: true
Size: 548 Bytes
Versions: 1
Compression:
Stored size: 548 Bytes
Contents
require 'spec_helper' require 'ronin/extensions/enumerable' describe Enumerable do describe "#map_hash" do it "should map elements to a Hash" do expect([1, 2, 3].map_hash { |i| i ** 2 }).to eq({ 1 => 1, 2 => 4, 3 => 9 }) end it "should not map the same element twice" do expect([1, 2, 2].map_hash { |i| rand }.keys).to match_array([1, 2]) end it "should set the default_proc of the Hash" do hash = [].map_hash { |i| i ** 2 } expect(hash[3]).to eq(9) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ronin-support-0.5.2 | spec/extensions/enumerable_spec.rb |