changelog shortlog tags changeset manifest revisions annotate raw

vendor/plugins/rspec/spec/spec/example/nested_example_group_spec.rb

changeset 15: 64acf98d15f4
author: moriq@moriq.com
date: Mon Mar 10 10:12:58 2008 +0900 (16 years ago)
permissions: -rw-r--r--
description: add plugins rspec
1require File.dirname(__FILE__) + '/../../spec_helper'
2
3module 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
59end