Sha256: 9cf3cfe53950880b3f25177bd075ea0560d8a46bd3a6581b790a66f3501a94a6
Contents?: true
Size: 1009 Bytes
Versions: 2
Compression:
Stored size: 1009 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe Hamster::List do [:filter, :select].each do |method| describe "#filter" do [ [[], []], [["A"], ["A"]], [["A", "B", "C"], ["A", "B", "C"]], [["A", "b", "C"], ["A", "C"]], [["a", "b", "c"], []], ].each do |values, result| describe "on #{values.inspect}" do list = Hamster.list(*values) describe "with a block" do it "returns #{result}" do list.send(method) { |item| item == item.upcase }.should == Hamster.list(*result) end it "is lazy" do count = 0 list.send(method) { |item| count += 1; true } count.should <= 1 end end describe "without a block" do it "returns self" do list.send(method).should == list end end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hamster-0.1.12 | spec/hamster/list/filter_spec.rb |
hamster-0.1.11 | spec/hamster/list/filter_spec.rb |