Sha256: c494a70ad9604029e58b29ab085d1e126bccbd463d58fe0f8becf702da746388
Contents?: true
Size: 553 Bytes
Versions: 5
Compression:
Stored size: 553 Bytes
Contents
describe Array do describe "#element_counts" do it "without a block" do expect([].element_counts).to eq({}) expect([1].element_counts).to eq({1 => 1}) expect([nil].element_counts).to eq({nil => 1}) expect([1, 2, 3, 1, 3, 1].element_counts).to eq({1 => 3, 2 => 1, 3 => 2}) end it "with a block" do expect([].element_counts(&:size)).to eq({}) expect(%w(a).element_counts(&:size)).to eq({1 => 1}) expect(%w(a aa aaa a aaa a).element_counts(&:size)).to eq({1 => 3, 2 => 1, 3 => 2}) end end end
Version data entries
5 entries across 5 versions & 1 rubygems