Sha256: f8d55897082957d6f819672f52bf4d6e8c0d0b8d4732898f54bac515b9ffe3e1
Contents?: true
Size: 1 KB
Versions: 3
Compression:
Stored size: 1 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::Set do [:reduce, :inject].each do |method| describe "##{method}" do describe "when empty" do before do @original = Hamster.set @result = @original.send(method, "ABC") {} end it "returns the memo" do @result.should == "ABC" end end describe "when not empty" do before do @original = Hamster.set("A", "B", "C") end describe "with a block" do before do @result = @original.send(method, 0) { |memo, item| memo + 1 } end it "returns the final memo" do @result.should == 3 end end describe "with no block" do before do @result = @original.send(method, "ABC") end it "returns the memo" do @result.should == "ABC" end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.13 | spec/hamster/set/reduce_spec.rb |
hamster-0.1.12 | spec/hamster/set/reduce_spec.rb |
hamster-0.1.11 | spec/hamster/set/reduce_spec.rb |