Skip to content

Commit 375240d

Browse files
committed
Add repro spec for #1800
1 parent 442f6d1 commit 375240d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

spec/rspec/rails/view_rendering_spec.rb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,5 +166,27 @@ def match_paths(*paths)
166166
eq paths.map { |path| File.expand_path path }
167167
end
168168
end
169+
170+
context "when a view is rendered in an example group that doesn't include ViewRendering" do
171+
let(:view) do
172+
ActionView::Base.new
173+
end
174+
175+
before do
176+
# We need to set ActiveSupport::LogSubscriber.logger here so that events will be properly logged.
177+
# https://github.com/rails/rails/blob/v5.1.1/activesupport/lib/active_support/log_subscriber.rb#L83
178+
logger = double('ActiveSupport::LogSubscriber.logger').as_null_object
179+
allow(ActiveSupport::LogSubscriber).to receive(:logger).and_return(logger)
180+
end
181+
182+
def logger
183+
ActiveSupport::LogSubscriber.logger
184+
end
185+
186+
pending 'does not cause an error' do
187+
expect(logger).not_to receive(:error).with(a_string_starting_with('Could not log "render_template.action_view" event.'))
188+
view.render(body: 'foo')
189+
end
190+
end
169191
end
170192
end

0 commit comments

Comments
 (0)