Sha256: 152c3cf08e0a62300f2219a7e3161293e6595e6df0809565d5c0e4f558d57b4a
Contents?: true
Size: 1.17 KB
Versions: 7
Compression:
Stored size: 1.17 KB
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') require 'hamster/set' describe Hamster::Set do [:remove, :reject, :delete_if].each do |method| describe "##{method}" do before do @original = Hamster.set("A", "B", "C") end describe "when nothing matches" do before do @result = @original.send(method) { |item| false } end it "returns self" do @result.should equal(@original) end end describe "when only some things match" do describe "with a block" do before do @result = @original.send(method) { |item| item == "A" } end it "preserves the original" do @original.should == Hamster.set("A", "B", "C") end it "returns a set with the matching values" do @result.should == Hamster.set("B", "C") end end describe "with no block" do before do @result = @original.send(method) end it "returns self" do @result.should equal(@original) end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems