Request spec failure (`render_template` matcher missing)
Context: My request spec failed: Failure/Error: expect(response).to render_template(:new) ... assert_template has been extracted to a gem. To continue using it, add
gem 'rails-controller-testing' to your Gemfile.
The render_template
matcher in RSpec request specs relies on functionality (assert_template
) that is no longer part of Rails core.
Resolution: I added gem 'rails-controller-testing'
to the :test
group in the Gemfile
and ran bundle install
.
Learning: I learned to be aware that testing helpers previously included in Rails core might be extracted into separate gems in newer versions. Error messages usually indicate the required gem (rails-controller-testing
for render_template
, assigns
, assert_template
).
Learned on: April 14, 2024
Edit