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

« back to all changes in this revision

Viewing changes to vendor/gems/rspec/spec/spec/example/nested_example_group_spec.rb

  • Committer: Bazaar Package Importer
  • Author(s): Micah Anderson
  • Date: 2008-07-26 15:43:45 UTC
  • mto: (3.1.1 lenny) (1.3.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 16.
  • Revision ID: james.westby@ubuntu.com-20080726154345-1fmgo76b4l72ulvc
ImportĀ upstreamĀ versionĀ 0.24.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require File.dirname(__FILE__) + '/../../spec_helper'
 
2
 
 
3
module Spec
 
4
  module Example
 
5
    describe 'Nested Example Groups' do
 
6
      parent = self
 
7
      
 
8
      def count
 
9
        @count ||= 0
 
10
        @count = @count + 1
 
11
        @count
 
12
      end
 
13
 
 
14
      before(:all) do
 
15
        count.should == 1
 
16
      end
 
17
 
 
18
      before(:all) do
 
19
        count.should == 2
 
20
      end
 
21
 
 
22
      before(:each) do
 
23
        count.should == 3
 
24
      end
 
25
 
 
26
      before(:each) do
 
27
        count.should == 4
 
28
      end
 
29
 
 
30
      it "should run before(:all), before(:each), example, after(:each), after(:all) in order" do
 
31
        count.should == 5
 
32
      end
 
33
 
 
34
      after(:each) do
 
35
        count.should == 7
 
36
      end
 
37
 
 
38
      after(:each) do
 
39
        count.should == 6
 
40
      end
 
41
 
 
42
      after(:all) do
 
43
        count.should == 9
 
44
      end
 
45
 
 
46
      after(:all) do
 
47
        count.should == 8
 
48
      end
 
49
 
 
50
      describe 'nested example group' do
 
51
        self.superclass.should == parent
 
52
        
 
53
        it "should run all before and after callbacks" do
 
54
          count.should == 5
 
55
        end
 
56
      end
 
57
    end
 
58
  end
 
59
end