~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): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mfrom: (1.1.8 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080726154345-c03m49twzxewdwjn
Tags: 0.24.5-2
* Fix puppetlast to work with 0.24.5
* Adjust logcheck to match against new log messages in 0.24.5
* Update standards version to 3.8.0 (no changes)
* Update changelog to reduce length of line to make lintian happy

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'