Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

36 lines (26 sloc) 0.853 kb
shared_examples_for "non-empty Stack" do
it { @stack.should_not be_empty }
it "should return the top item when sent #peek" do
@stack.peek.should == @last_item_added
end
it "should NOT remove the top item when sent #peek" do
@stack.peek.should == @last_item_added
@stack.peek.should == @last_item_added
end
it "should return the top item when sent #pop" do
@stack.pop.should == @last_item_added
end
it "should remove the top item when sent #pop" do
@stack.pop.should == @last_item_added
unless @stack.empty?
@stack.pop.should_not == @last_item_added
end
end
end
shared_examples_for "non-full Stack" do
it { @stack.should_not be_full }
it "should add to the top when sent #push" do
@stack.push "newly added top item"
@stack.peek.should == "newly added top item"
end
end
Jump to Line
Something went wrong with that request. Please try again.