Sha256: be29c59f97309aca15bd6d6cccbf1e5c898d547064c1518892a5d1f324573553

Contents?: true

Size: 636 Bytes

Versions: 3

Compression:

Stored size: 636 Bytes

Contents

require "spec_helper"
require "hamster/list"

describe Hamster::List do
  describe "#chunk" do
    it "is lazy" do
      -> { Hamster.stream { fail }.chunk(2) }.should_not raise_error
    end

    [
      [[], []],
      [["A"], [L["A"]]],
      [%w[A B C], [L["A", "B"], L["C"]]],
    ].each do |values, expected|
      context "on #{values.inspect}" do
        let(:list) { L[*values] }

        it "preserves the original" do
          list.chunk(2)
          list.should eql(L[*values])
        end

        it "returns #{expected.inspect}" do
          list.chunk(2).should eql(L[*expected])
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/hamster-3.0.0/spec/lib/hamster/list/chunk_spec.rb
hamster-3.0.0 spec/lib/hamster/list/chunk_spec.rb
hamster-2.0.0 spec/lib/hamster/list/chunk_spec.rb