Skip to content

[WIP] Fix NoMethodError: render_views? #1818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions spec/rspec/rails/view_rendering_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -166,5 +166,27 @@ def match_paths(*paths)
eq paths.map { |path| File.expand_path path }
end
end

context "when a view is rendered in an example group that doesn't include ViewRendering" do
let(:view) do
ActionView::Base.new
end

before do
# We need to set ActiveSupport::LogSubscriber.logger here so that events will be properly logged.
# https://github.com/rails/rails/blob/v5.1.1/activesupport/lib/active_support/log_subscriber.rb#L83
logger = double('ActiveSupport::LogSubscriber.logger').as_null_object
allow(ActiveSupport::LogSubscriber).to receive(:logger).and_return(logger)
end

def logger
ActiveSupport::LogSubscriber.logger
end

pending 'does not cause an error' do
expect(logger).not_to receive(:error).with(a_string_starting_with('Could not log "render_template.action_view" event.'))
view.render(body: 'foo')
end
end
end
end