Sha256: 6ffcad396ee137d133cd87337fa51293e0fe243d3ef77c55fcdd4060d8741eb4

Contents?: true

Size: 751 Bytes

Versions: 3

Compression:

Stored size: 751 Bytes

Contents

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

describe Hamster::List do

  describe "#each" do

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

      describe "on #{values.inspect}" do

        list = Hamster.list(*values)

        describe "with a block" do

          it "iterates over the items in order" do
            items = []
            list.each { |value| items << value }
            items.should == values
          end

          it "returns nil" do
            list.each {}.should be_nil
          end

        end

        describe "without a block" do

          it "returns self" do
            list.each.should == list
          end

        end

      end

    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hamster-0.1.13 spec/hamster/list/each_spec.rb
hamster-0.1.12 spec/hamster/list/each_spec.rb
hamster-0.1.11 spec/hamster/list/each_spec.rb