Sha256: 37de62f1a0379f58ef37af8dd01c04dc5d6a413d7b6f642ed5a1dba41a5e99e7

Contents?: true

Size: 871 Bytes

Versions: 15

Compression:

Stored size: 871 Bytes

Contents

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

require 'hamster/stack'

describe Hamster::Stack do

  [:push, :<<].each do |method|

    describe "##{method}" do

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

        describe "on #{values.inspect} with #{new_value.inspect}" do

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

          it "preserves the original" do
            @original.should == Hamster.stack(*values)
          end

          it "returns #{expected.inspect}" do
            @result.should == Hamster.stack(*expected)
          end

        end

      end

    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
hamster-0.2.5 spec/hamster/stack/push_spec.rb
hamster-0.2.4 spec/hamster/stack/push_spec.rb
hamster-0.2.3 spec/hamster/stack/push_spec.rb
hamster-0.2.2 spec/hamster/stack/push_spec.rb
hamster-0.2.1 spec/hamster/stack/push_spec.rb
hamster-0.2.0 spec/hamster/stack/push_spec.rb
hamster-0.1.23 spec/hamster/stack/push_spec.rb
hamster-0.1.22 spec/hamster/stack/push_spec.rb
hamster-0.1.21 spec/hamster/stack/push_spec.rb
hamster-0.1.20 spec/hamster/stack/push_spec.rb
hamster-0.1.19 spec/hamster/stack/push_spec.rb
hamster-0.1.18 spec/hamster/stack/push_spec.rb
hamster-0.1.17 spec/hamster/stack/push_spec.rb
hamster-0.1.16 spec/hamster/stack/push_spec.rb
hamster-0.1.15 spec/hamster/stack/push_spec.rb