rspec-core 2.0.0.a2 → 2.0.0.a3
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +2 -2
- data/.gitignore +1 -0
- data/README.markdown +18 -4
- data/Rakefile +6 -17
- data/bin/rspec +0 -8
- data/example_specs/failing/README.txt +1 -1
- data/example_specs/failing/spec_helper.rb +7 -2
- data/example_specs/failing/team_spec.rb +0 -1
- data/features/before_and_after_blocks/around.feature +2 -0
- data/features/command_line/example_name_option.feature +54 -0
- data/features/command_line/line_number_appended_to_path.feature +39 -0
- data/features/command_line/line_number_option.feature +40 -0
- data/features/matchers/define_matcher.feature +18 -4
- data/features/matchers/define_matcher_outside_rspec.feature +1 -2
- data/features/mocks/mix_stubs_and_mocks.feature +2 -0
- data/features/subject/explicit_subject.feature +4 -0
- data/features/subject/implicit_subject.feature +4 -0
- data/features/support/env.rb +15 -1
- data/lib/rspec/core.rb +1 -1
- data/lib/rspec/core/command_line_options.rb +9 -0
- data/lib/rspec/core/configuration.rb +18 -8
- data/lib/rspec/core/example.rb +14 -23
- data/lib/rspec/core/example_group.rb +39 -30
- data/lib/rspec/core/formatters/base_formatter.rb +9 -7
- data/lib/rspec/core/formatters/base_text_formatter.rb +2 -2
- data/lib/rspec/core/formatters/documentation_formatter.rb +10 -12
- data/lib/rspec/core/kernel_extensions.rb +2 -2
- data/lib/rspec/core/load_path.rb +1 -2
- data/lib/rspec/core/metadata.rb +65 -27
- data/lib/rspec/core/ruby_project.rb +24 -10
- data/lib/rspec/core/runner.rb +3 -3
- data/lib/rspec/core/{shared_behaviour.rb → shared_example_group.rb} +5 -5
- data/lib/rspec/core/{shared_behaviour_kernel_extensions.rb → shared_example_group_kernel_extensions.rb} +3 -3
- data/lib/rspec/core/version.rb +1 -1
- data/lib/rspec/core/world.rb +29 -50
- data/rspec-core.gemspec +22 -21
- data/spec/rspec/core/command_line_options_spec.rb +14 -0
- data/spec/rspec/core/configuration_spec.rb +51 -13
- data/spec/rspec/core/example_group_spec.rb +61 -68
- data/spec/rspec/core/example_group_subject_spec.rb +1 -1
- data/spec/rspec/core/example_spec.rb +19 -8
- data/spec/rspec/core/formatters/base_formatter_spec.rb +2 -2
- data/spec/rspec/core/metadata_spec.rb +52 -17
- data/spec/rspec/core/mocha_spec.rb +4 -4
- data/spec/rspec/core/pending_example_spec.rb +19 -0
- data/spec/rspec/core/ruby_project_spec.rb +24 -0
- data/spec/rspec/core/{shared_behaviour_spec.rb → shared_example_group_spec.rb} +31 -31
- data/spec/rspec/core/world_spec.rb +64 -83
- data/spec/spec_helper.rb +19 -30
- metadata +17 -17
- data/features-pending/command_line/line_number_option.feature +0 -56
- data/features-pending/command_line/line_number_option_with_example_with_no_name.feature +0 -22
- data/lib/rspec/core/extensions/instance_exec.rb +0 -31
- data/spec/resources/example_classes.rb +0 -67
- data/spec/rspec/core/resources/example_classes.rb +0 -67
@@ -43,6 +43,20 @@ describe Rspec::Core::CommandLineOptions do
|
|
43
43
|
|
44
44
|
end
|
45
45
|
|
46
|
+
describe 'line_number' do
|
47
|
+
it "is parsed from -l or --line_number" do
|
48
|
+
options_from_args('-l','3').should include(:line_number => '3')
|
49
|
+
options_from_args('--line_number','3').should include(:line_number => '3')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "example" do
|
54
|
+
it "is parsed from --example or -e" do
|
55
|
+
options_from_args('--example','foo').should include(:full_description => /foo/)
|
56
|
+
options_from_args('-e','bar').should include(:full_description => /bar/)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
46
60
|
describe "files_or_directories_to_run" do
|
47
61
|
|
48
62
|
it "parses files from '-c file.rb dir/file.rb'" do
|
@@ -102,6 +102,24 @@ describe Rspec::Core::Configuration do
|
|
102
102
|
|
103
103
|
end
|
104
104
|
|
105
|
+
context "with line number" do
|
106
|
+
|
107
|
+
it "assigns the line number as the filter" do
|
108
|
+
@config.files_or_directories_to_run = "path/to/a_spec.rb:37"
|
109
|
+
@config.filter.should == {:line_number => 37}
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
context "with full_description" do
|
115
|
+
|
116
|
+
it "assigns the example name as the filter on description" do
|
117
|
+
@config.full_description = "foo"
|
118
|
+
@config.filter.should == {:full_description => /foo/}
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
122
|
+
|
105
123
|
end
|
106
124
|
|
107
125
|
describe "include" do
|
@@ -112,14 +130,12 @@ describe Rspec::Core::Configuration do
|
|
112
130
|
end
|
113
131
|
end
|
114
132
|
|
115
|
-
it "should include the given module into each matching
|
133
|
+
it "should include the given module into each matching example group" do
|
116
134
|
Rspec::Core.configuration.include(InstanceLevelMethods, :magic_key => :include)
|
117
135
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
group.new.you_call_this_a_blt?.should == "egad man, where's the mayo?!?!?"
|
122
|
-
end
|
136
|
+
group = isolated_example_group('does like, stuff and junk', :magic_key => :include) { }
|
137
|
+
group.should_not respond_to(:you_call_this_a_blt?)
|
138
|
+
group.new.you_call_this_a_blt?.should == "egad man, where's the mayo?!?!?"
|
123
139
|
end
|
124
140
|
|
125
141
|
end
|
@@ -133,30 +149,30 @@ describe Rspec::Core::Configuration do
|
|
133
149
|
|
134
150
|
end
|
135
151
|
|
136
|
-
it "should extend the given module into each matching
|
152
|
+
it "should extend the given module into each matching example group" do
|
137
153
|
Rspec::Core.configuration.extend(ThatThingISentYou, :magic_key => :extend)
|
138
154
|
group = Rspec::Core::ExampleGroup.describe(ThatThingISentYou, :magic_key => :extend) { }
|
139
155
|
|
140
156
|
group.should respond_to(:that_thing)
|
141
|
-
|
157
|
+
remove_last_example_group_from_world
|
142
158
|
end
|
143
159
|
|
144
160
|
end
|
145
161
|
|
146
162
|
describe "run_all_when_everything_filtered" do
|
147
163
|
|
148
|
-
it "defaults to
|
149
|
-
Rspec::Core::Configuration.new.run_all_when_everything_filtered.should ==
|
164
|
+
it "defaults to false" do
|
165
|
+
Rspec::Core::Configuration.new.run_all_when_everything_filtered.should == false
|
150
166
|
end
|
151
167
|
|
152
168
|
it "can be queried with question method" do
|
153
169
|
config = Rspec::Core::Configuration.new
|
154
|
-
config.run_all_when_everything_filtered =
|
155
|
-
config.run_all_when_everything_filtered?.should ==
|
170
|
+
config.run_all_when_everything_filtered = true
|
171
|
+
config.run_all_when_everything_filtered?.should == true
|
156
172
|
end
|
157
173
|
end
|
158
174
|
|
159
|
-
describe 'formatter' do
|
175
|
+
describe 'formatter=' do
|
160
176
|
|
161
177
|
it "sets formatter_to_use based on name" do
|
162
178
|
config = Rspec::Core::Configuration.new
|
@@ -173,4 +189,26 @@ describe Rspec::Core::Configuration do
|
|
173
189
|
|
174
190
|
end
|
175
191
|
|
192
|
+
describe "line_number=" do
|
193
|
+
it "sets the line number" do
|
194
|
+
config = Rspec::Core::Configuration.new
|
195
|
+
config.line_number = '37'
|
196
|
+
config.filter.should == {:line_number => 37}
|
197
|
+
end
|
198
|
+
|
199
|
+
it "overrides :focused" do
|
200
|
+
config = Rspec::Core::Configuration.new
|
201
|
+
config.filter_run :focused => true
|
202
|
+
config.line_number = '37'
|
203
|
+
config.filter.should == {:line_number => 37}
|
204
|
+
end
|
205
|
+
|
206
|
+
it "prevents :focused" do
|
207
|
+
config = Rspec::Core::Configuration.new
|
208
|
+
config.line_number = '37'
|
209
|
+
config.filter_run :focused => true
|
210
|
+
config.filter.should == {:line_number => 37}
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
176
214
|
end
|
@@ -1,12 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
def empty_example_group(name='Empty ExampleGroup Group')
|
4
|
-
group = Rspec::Core::ExampleGroup.describe(Object, name) {}
|
5
|
-
remove_last_describe_from_world
|
6
|
-
yield group if block_given?
|
7
|
-
group
|
8
|
-
end
|
9
|
-
|
10
3
|
describe Rspec::Core::ExampleGroup do
|
11
4
|
|
12
5
|
describe "#describe" do
|
@@ -24,29 +17,26 @@ describe Rspec::Core::ExampleGroup do
|
|
24
17
|
describe '#name' do
|
25
18
|
|
26
19
|
it "uses the first parameter as name" do
|
27
|
-
|
20
|
+
disconnect_from_world do
|
28
21
|
Rspec::Core::ExampleGroup.describe("my favorite pony") { }.name.should == 'my favorite pony'
|
29
22
|
end
|
30
23
|
end
|
31
24
|
|
32
25
|
it "accepts a constant as the first parameter" do
|
33
|
-
|
26
|
+
disconnect_from_world do
|
34
27
|
Rspec::Core::ExampleGroup.describe(Object) { }.name.should == 'Object'
|
35
28
|
end
|
36
29
|
end
|
37
30
|
|
38
31
|
it "concats nested names" do
|
39
|
-
|
40
|
-
|
41
|
-
group = empty_example_group('test')
|
42
|
-
group.name.should == 'Object test'
|
32
|
+
group = isolated_example_group(Object, 'test')
|
33
|
+
group.name.should == 'Object test'
|
43
34
|
|
44
|
-
|
45
|
-
|
35
|
+
nested_group_one = group.describe('nested one') { }
|
36
|
+
nested_group_one.name.should == 'Object test nested one'
|
46
37
|
|
47
|
-
|
48
|
-
|
49
|
-
end
|
38
|
+
nested_group_two = nested_group_one.describe('nested two') { }
|
39
|
+
nested_group_two.name.should == 'Object test nested one nested two'
|
50
40
|
end
|
51
41
|
|
52
42
|
end
|
@@ -56,7 +46,7 @@ describe Rspec::Core::ExampleGroup do
|
|
56
46
|
context "with a constant as the first parameter" do
|
57
47
|
|
58
48
|
it "is that constant" do
|
59
|
-
|
49
|
+
disconnect_from_world do
|
60
50
|
Rspec::Core::ExampleGroup.describe(Object) { }.describes.should == Object
|
61
51
|
end
|
62
52
|
end
|
@@ -66,7 +56,7 @@ describe Rspec::Core::ExampleGroup do
|
|
66
56
|
context "with a string as the first parameter" do
|
67
57
|
|
68
58
|
it "is nil" do
|
69
|
-
|
59
|
+
disconnect_from_world do
|
70
60
|
Rspec::Core::ExampleGroup.describe("i'm a computer") { }.describes.should be_nil
|
71
61
|
end
|
72
62
|
end
|
@@ -78,14 +68,14 @@ describe Rspec::Core::ExampleGroup do
|
|
78
68
|
describe '#description' do
|
79
69
|
|
80
70
|
it "exposes the second parameter as description" do
|
81
|
-
|
71
|
+
disconnect_from_world do
|
82
72
|
Rspec::Core::ExampleGroup.describe(Object, "my desc") { }.description.should == 'my desc'
|
83
73
|
end
|
84
74
|
end
|
85
75
|
|
86
76
|
it "allows the second parameter to be nil" do
|
87
|
-
|
88
|
-
Rspec::Core::ExampleGroup.describe(Object, nil) { }.description.
|
77
|
+
disconnect_from_world do
|
78
|
+
Rspec::Core::ExampleGroup.describe(Object, nil) { }.description.should == ""
|
89
79
|
end
|
90
80
|
end
|
91
81
|
|
@@ -94,46 +84,46 @@ describe Rspec::Core::ExampleGroup do
|
|
94
84
|
describe '#metadata' do
|
95
85
|
|
96
86
|
it "adds the third parameter to the metadata" do
|
97
|
-
|
87
|
+
disconnect_from_world do
|
98
88
|
Rspec::Core::ExampleGroup.describe(Object, nil, 'foo' => 'bar') { }.metadata.should include({ "foo" => 'bar' })
|
99
89
|
end
|
100
90
|
end
|
101
91
|
|
102
92
|
it "adds the caller to metadata" do
|
103
|
-
|
104
|
-
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:
|
93
|
+
disconnect_from_world do
|
94
|
+
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:example_group][:caller].any? {|f|
|
105
95
|
f =~ /#{__FILE__}/
|
106
96
|
}.should be_true
|
107
97
|
end
|
108
98
|
end
|
109
99
|
|
110
100
|
it "adds the the file_path to metadata" do
|
111
|
-
|
112
|
-
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:
|
101
|
+
disconnect_from_world do
|
102
|
+
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:example_group][:file_path].should == __FILE__
|
113
103
|
end
|
114
104
|
end
|
115
105
|
|
116
106
|
it "has a reader for file_path" do
|
117
|
-
|
107
|
+
disconnect_from_world do
|
118
108
|
Rspec::Core::ExampleGroup.describe(Object) { }.file_path.should == __FILE__
|
119
109
|
end
|
120
110
|
end
|
121
111
|
|
122
112
|
it "adds the line_number to metadata" do
|
123
|
-
|
124
|
-
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:
|
113
|
+
disconnect_from_world do
|
114
|
+
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:example_group][:line_number].should == __LINE__
|
125
115
|
end
|
126
116
|
end
|
127
117
|
|
128
118
|
it "adds file path and line number metadata for arbitrarily nested describes" do
|
129
119
|
Rspec::Core::ExampleGroup.describe(Object) do
|
130
120
|
Rspec::Core::ExampleGroup.describe("foo") do
|
131
|
-
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:
|
132
|
-
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:
|
121
|
+
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:example_group][:file_path].should == __FILE__
|
122
|
+
Rspec::Core::ExampleGroup.describe(Object) { }.metadata[:example_group][:line_number].should == __LINE__
|
133
123
|
end
|
134
124
|
end
|
135
125
|
|
136
|
-
4.times {
|
126
|
+
4.times { remove_last_example_group_from_world }
|
137
127
|
end
|
138
128
|
|
139
129
|
end
|
@@ -141,13 +131,13 @@ describe Rspec::Core::ExampleGroup do
|
|
141
131
|
describe "adding before, after, and around hooks" do
|
142
132
|
|
143
133
|
it "should expose the before each blocks at before_eachs" do
|
144
|
-
group =
|
134
|
+
group = isolated_example_group
|
145
135
|
group.before(:each) { 'foo' }
|
146
136
|
group.should have(1).before_eachs
|
147
137
|
end
|
148
138
|
|
149
139
|
it "should maintain the before each block order" do
|
150
|
-
group =
|
140
|
+
group = isolated_example_group
|
151
141
|
group.before(:each) { 15 }
|
152
142
|
group.before(:each) { 'A' }
|
153
143
|
group.before(:each) { 33.5 }
|
@@ -158,13 +148,13 @@ describe Rspec::Core::ExampleGroup do
|
|
158
148
|
end
|
159
149
|
|
160
150
|
it "should expose the before all blocks at before_alls" do
|
161
|
-
group =
|
151
|
+
group = isolated_example_group
|
162
152
|
group.before(:all) { 'foo' }
|
163
153
|
group.should have(1).before_alls
|
164
154
|
end
|
165
155
|
|
166
156
|
it "should maintain the before all block order" do
|
167
|
-
group =
|
157
|
+
group = isolated_example_group
|
168
158
|
group.before(:all) { 15 }
|
169
159
|
group.before(:all) { 'A' }
|
170
160
|
group.before(:all) { 33.5 }
|
@@ -175,13 +165,13 @@ describe Rspec::Core::ExampleGroup do
|
|
175
165
|
end
|
176
166
|
|
177
167
|
it "should expose the after each blocks at after_eachs" do
|
178
|
-
group =
|
168
|
+
group = isolated_example_group
|
179
169
|
group.after(:each) { 'foo' }
|
180
170
|
group.should have(1).after_eachs
|
181
171
|
end
|
182
172
|
|
183
173
|
it "should maintain the after each block order" do
|
184
|
-
group =
|
174
|
+
group = isolated_example_group
|
185
175
|
group.after(:each) { 15 }
|
186
176
|
group.after(:each) { 'A' }
|
187
177
|
group.after(:each) { 33.5 }
|
@@ -192,13 +182,13 @@ describe Rspec::Core::ExampleGroup do
|
|
192
182
|
end
|
193
183
|
|
194
184
|
it "should expose the after all blocks at after_alls" do
|
195
|
-
group =
|
185
|
+
group = isolated_example_group
|
196
186
|
group.after(:all) { 'foo' }
|
197
187
|
group.should have(1).after_alls
|
198
188
|
end
|
199
189
|
|
200
190
|
it "should maintain the after each block order" do
|
201
|
-
group =
|
191
|
+
group = isolated_example_group
|
202
192
|
group.after(:all) { 15 }
|
203
193
|
group.after(:all) { 'A' }
|
204
194
|
group.after(:all) { 33.5 }
|
@@ -209,7 +199,7 @@ describe Rspec::Core::ExampleGroup do
|
|
209
199
|
end
|
210
200
|
|
211
201
|
it "should expose the around each blocks at after_alls" do
|
212
|
-
group =
|
202
|
+
group = isolated_example_group
|
213
203
|
group.around(:each) { 'foo' }
|
214
204
|
group.should have(1).around_eachs
|
215
205
|
end
|
@@ -219,13 +209,13 @@ describe Rspec::Core::ExampleGroup do
|
|
219
209
|
describe "adding examples" do
|
220
210
|
|
221
211
|
it "should allow adding an example using 'it'" do
|
222
|
-
group =
|
212
|
+
group = isolated_example_group
|
223
213
|
group.it("should do something") { }
|
224
214
|
group.examples.size.should == 1
|
225
215
|
end
|
226
216
|
|
227
217
|
it "should expose all examples at examples" do
|
228
|
-
group =
|
218
|
+
group = isolated_example_group
|
229
219
|
group.it("should do something 1") { }
|
230
220
|
group.it("should do something 2") { }
|
231
221
|
group.it("should do something 3") { }
|
@@ -233,7 +223,7 @@ describe Rspec::Core::ExampleGroup do
|
|
233
223
|
end
|
234
224
|
|
235
225
|
it "should maintain the example order" do
|
236
|
-
group =
|
226
|
+
group = isolated_example_group
|
237
227
|
group.it("should 1") { }
|
238
228
|
group.it("should 2") { }
|
239
229
|
group.it("should 3") { }
|
@@ -248,15 +238,15 @@ describe Rspec::Core::ExampleGroup do
|
|
248
238
|
|
249
239
|
describe "A sample nested group", :nested_describe => "yep" do
|
250
240
|
it "sets the described class to the constant Object" do
|
251
|
-
running_example.
|
241
|
+
running_example.example_group.describes.should == Object
|
252
242
|
end
|
253
243
|
|
254
244
|
it "sets the description to 'A sample nested describe'" do
|
255
|
-
running_example.
|
245
|
+
running_example.example_group.description.should == 'A sample nested group'
|
256
246
|
end
|
257
247
|
|
258
|
-
it "has top level metadata from the
|
259
|
-
running_example.
|
248
|
+
it "has top level metadata from the example_group and its ancestors" do
|
249
|
+
running_example.example_group.metadata.should include(:little_less_nested => 'yep', :nested_describe => 'yep')
|
260
250
|
end
|
261
251
|
|
262
252
|
it "exposes the parent metadata to the contained examples" do
|
@@ -271,41 +261,44 @@ describe Rspec::Core::ExampleGroup do
|
|
271
261
|
@fake_formatter = Rspec::Core::Formatters::BaseFormatter.new
|
272
262
|
end
|
273
263
|
|
274
|
-
def
|
275
|
-
|
276
|
-
|
277
|
-
|
264
|
+
def stub_example_group
|
265
|
+
stub('example_group',
|
266
|
+
:metadata => Rspec::Core::Metadata.new.process(
|
267
|
+
'example_group_name',
|
268
|
+
:caller => ['foo_spec.rb:37']
|
269
|
+
)
|
270
|
+
).as_null_object
|
278
271
|
end
|
279
272
|
|
280
273
|
it "should return true if all examples pass" do
|
281
274
|
use_formatter(@fake_formatter) do
|
282
|
-
passing_example1 = Rspec::Core::Example.new(
|
283
|
-
passing_example2 = Rspec::Core::Example.new(
|
275
|
+
passing_example1 = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 1 }))
|
276
|
+
passing_example2 = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 1 }))
|
284
277
|
Rspec::Core::ExampleGroup.stub!(:examples_to_run).and_return([passing_example1, passing_example2])
|
285
278
|
|
286
|
-
Rspec::Core::ExampleGroup.run_examples(
|
279
|
+
Rspec::Core::ExampleGroup.run_examples(stub_example_group, mock('reporter').as_null_object).should be_true
|
287
280
|
end
|
288
281
|
end
|
289
282
|
|
290
283
|
it "should return false if any of the examples return false" do
|
291
284
|
use_formatter(@fake_formatter) do
|
292
|
-
failing_example = Rspec::Core::Example.new(
|
293
|
-
passing_example = Rspec::Core::Example.new(
|
285
|
+
failing_example = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 2 }))
|
286
|
+
passing_example = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 1 }))
|
294
287
|
Rspec::Core::ExampleGroup.stub!(:examples_to_run).and_return([failing_example, passing_example])
|
295
288
|
|
296
|
-
Rspec::Core::ExampleGroup.run_examples(
|
289
|
+
Rspec::Core::ExampleGroup.run_examples(stub_example_group, mock('reporter').as_null_object).should be_false
|
297
290
|
end
|
298
291
|
end
|
299
292
|
|
300
293
|
it "should run all examples, regardless of any of them failing" do
|
301
294
|
use_formatter(@fake_formatter) do
|
302
|
-
failing_example = Rspec::Core::Example.new(
|
303
|
-
passing_example = Rspec::Core::Example.new(
|
295
|
+
failing_example = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 2 }))
|
296
|
+
passing_example = Rspec::Core::Example.new(stub_example_group, 'description', {}, (lambda { 1.should == 1 }))
|
304
297
|
Rspec::Core::ExampleGroup.stub!(:examples_to_run).and_return([failing_example, passing_example])
|
305
298
|
|
306
299
|
passing_example.should_receive(:run)
|
307
300
|
|
308
|
-
Rspec::Core::ExampleGroup.run_examples(
|
301
|
+
Rspec::Core::ExampleGroup.run_examples(stub_example_group, mock('reporter', :null_object => true))
|
309
302
|
end
|
310
303
|
end
|
311
304
|
|
@@ -330,19 +323,19 @@ describe Rspec::Core::ExampleGroup do
|
|
330
323
|
|
331
324
|
it "should be able to access the before all ivars in the before_all_ivars hash" do
|
332
325
|
with_ruby('1.8') do
|
333
|
-
running_example.
|
326
|
+
running_example.example_group.before_all_ivars.should include('@before_all_top_level' => 'before_all_top_level')
|
334
327
|
end
|
335
328
|
with_ruby('1.9') do
|
336
|
-
running_example.
|
329
|
+
running_example.example_group.before_all_ivars.should include(:@before_all_top_level => 'before_all_top_level')
|
337
330
|
end
|
338
331
|
end
|
339
332
|
|
340
333
|
describe "but now I am nested" do
|
341
|
-
it "should be able to access a parent
|
334
|
+
it "should be able to access a parent example groups before each ivar at a nested level" do
|
342
335
|
@before_each_top_level.should == 'before_each_top_level'
|
343
336
|
end
|
344
337
|
|
345
|
-
it "should be able to access a parent
|
338
|
+
it "should be able to access a parent example groups before all ivar at a nested level" do
|
346
339
|
@before_all_top_level.should == "before_all_top_level"
|
347
340
|
end
|
348
341
|
|
@@ -350,7 +343,7 @@ describe Rspec::Core::ExampleGroup do
|
|
350
343
|
@before_all_top_level = "ive been changed"
|
351
344
|
end
|
352
345
|
|
353
|
-
describe "accessing a before_all ivar that was changed in a parent
|
346
|
+
describe "accessing a before_all ivar that was changed in a parent example_group" do
|
354
347
|
it "does not have access to the modified version" do
|
355
348
|
@before_all_top_level.should == 'before_all_top_level'
|
356
349
|
end
|