Sha256: 807acd2e28f6557cd8a0f6829afa8e6939b774722fdf2cae1d2416cec75d44cf

Contents?: true

Size: 815 Bytes

Versions: 2

Compression:

Stored size: 815 Bytes

Contents

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

require 'hamster/stack'

describe Hamster::Stack do

  [:to_a, :entries].each do |method|

    describe "##{method}" do

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

        describe "on #{values.inspect}" do

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

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

          it "returns a mutable array" do
            @result.last.should_not == "The End"
            @result << "The End"
            @result.last.should == "The End"
          end

        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hamster-0.2.7 spec/hamster/stack/to_a_spec.rb
hamster-0.2.6 spec/hamster/stack/to_a_spec.rb