Sha256: 639ddf4fd28aae5626bc0e5ccba4a42bef3131a3fba326fc6661c895256f57e7
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.2.7 | spec/hamster/list/filter_spec.rb |
hamster-0.2.6 | spec/hamster/list/filter_spec.rb |