]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/example/nested_example_group_spec.rb
Show whether a trace is public or private in the trace list, so that a user can easil...
[rails.git] / vendor / gems / rspec-1.1.2 / spec / spec / example / nested_example_group_spec.rb
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