File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -247,18 +247,23 @@ def _view; end # Stub method
247
247
pending_only_on_ruby_22_rails_52 = false
248
248
end
249
249
250
- it 'is accessible to hooks' , pending : pending_only_on_ruby_22_rails_52 do
251
- group = RSpec ::Core ::ExampleGroup . describe 'a view' , type : :view do
252
- specify { true }
253
- end
254
- run_count = 0
255
- group . before ( :each ) do
256
- allow ( view ) . to receive ( :render ) { :value }
257
- run_count += 1
250
+ # Regression test from rspec/rspec-rails#833
251
+ it 'is accessible to configuration-level hooks' , pending : pending_only_on_ruby_22_rails_52 do
252
+ with_isolated_config do
253
+ run_count = 0
254
+ RSpec . configuration . before ( :each , type : :view ) do
255
+ # `view` is provided from the view example type, and serves to
256
+ # demonstrate this hook is run in the correct context.
257
+ allow ( view ) . to receive ( :render ) { :value }
258
+ run_count += 1
259
+ end
260
+ group = RSpec ::Core ::ExampleGroup . describe 'a view' , type : :view do
261
+ specify { expect ( view . render ) . to eq ( :value ) }
262
+ end
263
+ group . run ( failure_reporter )
264
+ expect ( failure_reporter . exceptions ) . to eq [ ]
265
+ expect ( run_count ) . to eq 1
258
266
end
259
- group . run ( failure_reporter )
260
- expect ( failure_reporter . exceptions ) . to eq [ ]
261
- expect ( run_count ) . to eq 1
262
267
end
263
268
end
264
269
You can’t perform that action at this time.
0 commit comments