Sha256: f462f7bec3776b6f06e944dade2a4c870fa7370aa7d84abe2d18417a374e9ac7

Contents?: true

Size: 864 Bytes

Versions: 5

Compression:

Stored size: 864 Bytes

Contents

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

require 'hamster/list'

describe Hamster::List do

  [:empty?, :null?].each do |method|

    describe "##{method}" do

      describe "on a really big list" do

        before do
          @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH)
        end

        it "doesn't run out of stack" do
          lambda { @list.filter(&:nil?).empty? }.should_not raise_error
        end

      end

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

        describe "on #{values.inspect}" do

          before do
            @result = Hamster.list(*values).send(method)
          end

          it "returns #{expected.inspect}" do
            @result.should == expected
          end

        end

      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/list/empty_spec.rb
hamster-0.2.4 spec/hamster/list/empty_spec.rb
hamster-0.2.3 spec/hamster/list/empty_spec.rb
hamster-0.2.2 spec/hamster/list/empty_spec.rb
hamster-0.2.1 spec/hamster/list/empty_spec.rb