File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,16 @@ def self.nullify_template_rendering(templates)
64
64
# @private
65
65
class LogSubscriber < ::ActiveSupport ::LogSubscriber
66
66
def current_example_group
67
- RSpec . current_example . example_group
67
+ # When running feature specs current_example can be nil if the subscriber runs in a different context
68
+ # than the specs themselves. E.g. in a capybara thread.
69
+ RSpec . current_example . try! ( :example_group )
68
70
end
69
71
70
72
def render_template ( _event )
71
- return if current_example_group . render_views?
72
- info ( " Template rendering was prevented by rspec-rails. Use `render_views` to verify rendered view contents if necessary." )
73
+ example_group = current_example_group
74
+ if example_group . respond_to? ( :render_views? ) && !example_group . render_views?
75
+ info ( " Template rendering was prevented by rspec-rails. Use `render_views` to verify rendered view contents if necessary." )
76
+ end
73
77
end
74
78
end
75
79
Original file line number Diff line number Diff line change @@ -183,7 +183,7 @@ def logger
183
183
ActiveSupport ::LogSubscriber . logger
184
184
end
185
185
186
- pending 'does not cause an error' do
186
+ it 'does not cause an error' do
187
187
expect ( logger ) . not_to receive ( :error ) . with ( a_string_starting_with ( 'Could not log "render_template.action_view" event.' ) )
188
188
view . render ( body : 'foo' )
189
189
end
You can’t perform that action at this time.
0 commit comments