Sha256: 9cd8f18bfb333e5c1f02f84095e5ea171cf6b5cbcc8e71fd1884af4e88673e24

Contents?: true

Size: 726 Bytes

Versions: 1

Compression:

Stored size: 726 Bytes

Contents

require "spec_helper"

require "hamster/list"

describe Hamster::List do

  describe "#init" do

    it "is lazy" do
      -> { Hamster.stream { false }.init }.should_not raise_error
    end

    [
      [[], []],
      [["A"], []],
      [%w[A B C], %w[A B]],
    ].each do |values, expected|

      describe "on #{values.inspect}" do

        before do
          @original = Hamster.list(*values)
          @result = @original.init
        end

        it "preserves the original" do
          @original.should == Hamster.list(*values)
        end

        it "returns the list without the last element: #{expected.inspect}" do
          @result.should == Hamster.list(*expected)
        end

      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hamster-1.0.1.pre.rc.1 spec/hamster/list/init_spec.rb