Sha256: 7a86fb4dd73ad76f9e58c432fcdda877bb8742aa8cd2e6450b065ba7aede5373

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 do

  describe ".stack" do

    describe "with no arguments" do

      before do
        @stack = Hamster.stack
      end

      it "always returns the same instance" do
        @stack.should equal(Hamster.stack)
      end

      it "returns an empty stack" do
        @stack.should be_empty
      end

    end

    describe "with a number of items" do

      before do
        @stack = Hamster.stack("A", "B", "C")
      end

      it "always returns a different instance" do
        @stack.should_not equal(Hamster.stack("A", "B", "C"))
      end

      it "is the same as repeatedly using #push" do
        @stack.should == Hamster.stack.push("A").push("B").push("C")
      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

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