Sha256: 313a45809f3544785d01d0cded04ffd50982eb16c653b0f9f9bfb5ff3ca7ca34
Contents?: true
Size: 1015 Bytes
Versions: 2
Compression:
Stored size: 1015 Bytes
Contents
require File.expand_path('../../spec_helper', File.dirname(__FILE__)) require 'hamster/set' describe Hamster::Set do [:find, :detect].each do |method| describe "##{method}" do [ [[], "A", nil], [[], nil, nil], [["A"], "A", "A"], [["A"], "B", nil], [["A"], nil, nil], [["A", "B", nil], "A", "A"], [["A", "B", nil], "B", "B"], [["A", "B", nil], nil, nil], [["A", "B", nil], "C", nil], ].each do |values, item, expected| describe "on #{values.inspect}" do before do @set = Hamster.set(*values) end describe "with a block" do it "returns #{expected.inspect}" do @set.send(method) { |x| x == item }.should == expected end end describe "without a block" do it "returns nil" do @set.send(method).should be_nil 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/set/find_spec.rb |
hamster-0.2.6 | spec/hamster/set/find_spec.rb |