Sha256: ef98f11ceb122dd65475d21a0fad2b76d016b4c49b56ef0bb077a6cd61001909

Contents?: true

Size: 817 Bytes

Versions: 4

Compression:

Stored size: 817 Bytes

Contents

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

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

4 entries across 4 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/stack/to_a_spec.rb
hamster-0.2.4 spec/hamster/stack/to_a_spec.rb
hamster-0.2.3 spec/hamster/stack/to_a_spec.rb
hamster-0.2.2 spec/hamster/stack/to_a_spec.rb