1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
require 'spec_helper'
module Spec
module Example
describe ExampleGroupFactory do
it "should return a ModelExampleGroup when given :type => :model" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :type => :model
) {}
example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
end
it "should return a ModelExampleGroup when given :location => '/blah/spec/models/'" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/models/blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
end
it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\models\\' (windows format)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '\\blah\\spec\\models\\blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ModelExampleGroup
end
it "should return an ActiveSupport::TestCase when given :location => '/blah/spec/foo/' (anything other than controllers, views and helpers)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/foo/blah.rb'
) {}
example_group.superclass.should == ActiveSupport::TestCase
end
it "should return an ActiveSupport::TestCase when given :location => '\\blah\\spec\\foo\\' (windows format) (anything other than controllers, views and helpers)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '\\blah\\spec\\foo\\blah.rb'
) {}
example_group.superclass.should == ActiveSupport::TestCase
end
it "should return a ViewExampleGroup when given :type => :view" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :type => :view
) {}
example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
end
it "should return a ViewExampleGroup when given :location => '/blah/spec/views/'" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/views/blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
end
it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\views\\' (windows format)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '\\blah\\spec\\views\\blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ViewExampleGroup
end
it "should return a HelperExampleGroup when given :type => :helper" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :type => :helper
) {}
example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
end
it "should return a HelperExampleGroup when given :location => '/blah/spec/helpers/'" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/helpers/blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
end
it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\helpers\\' (windows format)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '\\blah\\spec\\helpers\\blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::HelperExampleGroup
end
it "should return a ControllerExampleGroup when given :type => :controller" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :type => :controller
) {}
example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
end
it "should return a ControllerExampleGroup when given :location => '/blah/spec/controllers/'" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/controllers/blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
end
it "should return a ModelExampleGroup when given :location => '\\blah\\spec\\controllers\\' (windows format)" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '\\blah\\spec\\controllers\\blah.rb'
) {}
example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
end
it "should favor the :type over the :location" do
example_group = Spec::Example::ExampleGroupFactory.create_example_group(
"name", :location => '/blah/spec/models/blah.rb', :type => :controller
) {}
example_group.superclass.should == Spec::Rails::Example::ControllerExampleGroup
end
end
end
end
|