Sha256: edbad87eda6a047f2bf35ca97ecd591c32c80a33c5de702d5cd8669decbef543
Contents?: true
Size: 1.03 KB
Versions: 13
Compression:
Stored size: 1.03 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/set' describe Hamster::Set do [:reduce, :inject, :fold].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
13 entries across 13 versions & 1 rubygems