Sha256: 0f13ffbd883d7d20735e6c617cf8712e242eb77975ebe4bf3df0af8c79412ba4

Contents?: true

Size: 743 Bytes

Versions: 2

Compression:

Stored size: 743 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')

describe Hamster::List do

  [:include?, :member?].each do |method|

    describe "##{method}" do

      [
        [[], "A", false],
        [[], nil, false],
        [["A"], "A", true],
        [["A"], "B", false],
        [["A"], nil, false],
        [["A", "B", nil], "A", true],
        [["A", "B", nil], "B", true],
        [["A", "B", nil], nil, true],
        [["A", "B", nil], "C", false],
      ].each do |values, item, result|

        describe "on #{values.inspect}" do

          list = Hamster.list(*values)

          it "returns #{result}" do
            list.send(method, item).should == result
          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/include_spec.rb
hamster-0.1.11 spec/hamster/list/include_spec.rb