Sha256: 14f7d62aab7077ff3057d63e5225b30fd90be92350e132b75ec073b98268a453

Contents?: true

Size: 879 Bytes

Versions: 2

Compression:

Stored size: 879 Bytes

Contents

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

describe Hamster::List do

  describe "#cadr" do

    [
      [[], :car, nil],
      [["A"], :car, "A"],
      [["A", "B", "C"], :car, "A"],
      [["A", "B", "C"], :cadr, "B"],
      [["A", "B", "C"], :caddr, "C"],
      [["A", "B", "C"], :cadddr, nil],
      [["A", "B", "C"], :caddddr, nil],
      [[], :cdr, Hamster.list],
      [["A"], :cdr, Hamster.list],
      [["A", "B", "C"], :cdr, Hamster.list("B", "C")],
      [["A", "B", "C"], :cddr, Hamster.list("C")],
      [["A", "B", "C"], :cdddr, Hamster.list],
      [["A", "B", "C"], :cddddr, Hamster.list],
    ].each do |values, method, result|

      describe "on #{values.inspect}" do

        list = Hamster.list(*values)

        it "returns #{result}" do
          list.send(method).should == result
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-0.1.12 spec/hamster/list/cadr_spec.rb
hamster-0.1.11 spec/hamster/list/cadr_spec.rb