]> git.openstreetmap.org Git - rails.git/blob - vendor/gems/rspec-1.1.2/spec/spec/runner/spec_parser_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 / runner / spec_parser_spec.rb
1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
2
3 describe "c" do
4
5   it "1" do
6   end
7
8   it "2" do
9   end
10
11 end
12
13 describe "d" do
14
15   it "3" do
16   end
17
18   it "4" do
19   end
20
21 end
22
23 class SpecParserSubject
24 end
25
26 describe SpecParserSubject do
27   
28   it "5" do
29   end
30   
31 end
32
33 describe SpecParserSubject, "described" do
34   
35   it "6" do
36   end
37   
38 end
39
40 describe SpecParserSubject, "described", :something => :something_else do
41    
42    it "7" do
43    end
44
45 end
46
47 describe "described", :something => :something_else do
48   
49   it "8" do
50   end
51   
52 end
53    
54
55 describe "SpecParser" do
56   before(:each) do
57     @p = Spec::Runner::SpecParser.new
58   end
59
60   it "should find spec name for 'specify' at same line" do
61     @p.spec_name_for(File.open(__FILE__), 5).should == "c 1"
62   end
63
64   it "should find spec name for 'specify' at end of spec line" do
65     @p.spec_name_for(File.open(__FILE__), 6).should == "c 1"
66   end
67
68   it "should find context for 'context' above all specs" do
69     @p.spec_name_for(File.open(__FILE__), 4).should == "c"
70   end
71
72   it "should find spec name for 'it' at same line" do
73     @p.spec_name_for(File.open(__FILE__), 15).should == "d 3"
74   end
75
76   it "should find spec name for 'it' at end of spec line" do
77     @p.spec_name_for(File.open(__FILE__), 16).should == "d 3"
78   end
79
80   it "should find context for 'describe' above all specs" do
81     @p.spec_name_for(File.open(__FILE__), 14).should == "d"
82   end
83
84  it "should find nearest example name between examples" do
85    @p.spec_name_for(File.open(__FILE__), 7).should == "c 1"
86  end
87
88   it "should find nothing outside a context" do
89     @p.spec_name_for(File.open(__FILE__), 2).should be_nil
90   end
91   
92   it "should find context name for type" do
93     @p.spec_name_for(File.open(__FILE__), 26).should == "SpecParserSubject"
94   end
95   
96   it "should find context and spec name for type" do
97     @p.spec_name_for(File.open(__FILE__), 28).should == "SpecParserSubject 5"
98   end
99
100   it "should find context and description for type" do
101     @p.spec_name_for(File.open(__FILE__), 33).should == "SpecParserSubject described"
102   end
103   
104   it "should find context and description and example for type" do
105     @p.spec_name_for(File.open(__FILE__), 36).should == "SpecParserSubject described 6"
106   end
107
108   it "should find context and description for type with modifications" do
109     @p.spec_name_for(File.open(__FILE__), 40).should == "SpecParserSubject described"
110   end
111   
112   it "should find context and described and example for type with modifications" do
113     @p.spec_name_for(File.open(__FILE__), 43).should == "SpecParserSubject described 7"
114   end
115   
116   it "should find example group" do
117     @p.spec_name_for(File.open(__FILE__), 47).should == "described"
118   end
119   
120   it "should find example" do
121     @p.spec_name_for(File.open(__FILE__), 50).should == "described 8"
122   end
123   
124 end