1 require File.dirname(__FILE__) + '/../../spec_helper.rb'
23 class SpecParserSubject
26 describe SpecParserSubject do
33 describe SpecParserSubject, "described" do
40 describe SpecParserSubject, "described", :something => :something_else do
47 describe "described", :something => :something_else do
55 describe "SpecParser" do
57 @p = Spec::Runner::SpecParser.new
60 it "should find spec name for 'specify' at same line" do
61 @p.spec_name_for(File.open(__FILE__), 5).should == "c 1"
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"
68 it "should find context for 'context' above all specs" do
69 @p.spec_name_for(File.open(__FILE__), 4).should == "c"
72 it "should find spec name for 'it' at same line" do
73 @p.spec_name_for(File.open(__FILE__), 15).should == "d 3"
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"
80 it "should find context for 'describe' above all specs" do
81 @p.spec_name_for(File.open(__FILE__), 14).should == "d"
84 it "should find nearest example name between examples" do
85 @p.spec_name_for(File.open(__FILE__), 7).should == "c 1"
88 it "should find nothing outside a context" do
89 @p.spec_name_for(File.open(__FILE__), 2).should be_nil
92 it "should find context name for type" do
93 @p.spec_name_for(File.open(__FILE__), 26).should == "SpecParserSubject"
96 it "should find context and spec name for type" do
97 @p.spec_name_for(File.open(__FILE__), 28).should == "SpecParserSubject 5"
100 it "should find context and description for type" do
101 @p.spec_name_for(File.open(__FILE__), 33).should == "SpecParserSubject described"
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"
108 it "should find context and description for type with modifications" do
109 @p.spec_name_for(File.open(__FILE__), 40).should == "SpecParserSubject described"
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"
116 it "should find example group" do
117 @p.spec_name_for(File.open(__FILE__), 47).should == "described"
120 it "should find example" do
121 @p.spec_name_for(File.open(__FILE__), 50).should == "described 8"