Sha256: 54f7f064fb743efcaf15cce13b9f8c0dd5352947f14d6f142051f7eb275d17e1
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
require 'spec_helper' require 'hamster/list' describe Hamster::List do [:filter, :select, :find_all].each do |method| describe "##{method}" do it "is lazy" do lambda { Hamster.stream { fail }.filter { |item| false } }.should_not raise_error end [ [[], []], [["A"], ["A"]], [["A", "B", "C"], ["A", "B", "C"]], [["A", "b", "C"], ["A", "C"]], [["a", "b", "c"], []], ].each do |values, expected| describe "on #{values.inspect}" do before do @original = Hamster.list(*values) end describe "with a block" do before do @result = @original.send(method) { |item| item == item.upcase } end it "preserves the original" do @original.should == Hamster.list(*values) end it "returns #{expected.inspect}" do @result.should == Hamster.list(*expected) end end describe "without a block" do it "returns self" do @original.send(method).should equal(@original) end end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems