~ubuntu-branches/ubuntu/oneiric/puppet/oneiric-security

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/examples/pure/shared_stack_examples.rb

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Pollock
  • Date: 2009-04-13 17:12:47 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (3.1.3 squeeze) (1.2.3 upstream)
  • mto: This revision was merged to the branch mainline in revision 18.
  • Revision ID: james.westby@ubuntu.com-20090413171247-61zlnwi5esw1lhtv
ImportĀ upstreamĀ versionĀ 0.24.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require File.join(File.dirname(__FILE__), *%w[spec_helper])
2
 
 
3
 
shared_examples_for "non-empty Stack" do
4
 
 
5
 
  it { @stack.should_not be_empty }
6
 
  
7
 
  it "should return the top item when sent #peek" do
8
 
    @stack.peek.should == @last_item_added
9
 
  end
10
 
 
11
 
  it "should NOT remove the top item when sent #peek" do
12
 
    @stack.peek.should == @last_item_added
13
 
    @stack.peek.should == @last_item_added
14
 
  end
15
 
  
16
 
  it "should return the top item when sent #pop" do
17
 
    @stack.pop.should == @last_item_added
18
 
  end
19
 
  
20
 
  it "should remove the top item when sent #pop" do
21
 
    @stack.pop.should == @last_item_added
22
 
    unless @stack.empty?
23
 
      @stack.pop.should_not == @last_item_added
24
 
    end
25
 
  end
26
 
  
27
 
end
28
 
 
29
 
shared_examples_for "non-full Stack" do
30
 
 
31
 
  it { @stack.should_not be_full }
32
 
 
33
 
  it "should add to the top when sent #push" do
34
 
    @stack.push "newly added top item"
35
 
    @stack.peek.should == "newly added top item"
36
 
  end
37
 
 
38
 
end
 
 
b'\\ No newline at end of file'