Class: Rubocop::Cop::RSpec::RailsControllerTesting
- Inherits:
-
Base
- Object
- RuboCop::Cop::RSpec::Base
- Base
- Rubocop::Cop::RSpec::RailsControllerTesting
- Defined in:
- lib/rubocop/cop/rspec/rails_controller_testing.rb
Overview
Flags the use of ‘assigns` and `render_template` in controller and request specs.
Constant Summary collapse
- MSG_TEMPLATE =
"Avoid using `%{name}`. Instead, assert on observable outputs such as the response body. See https://docs.gitlab.com/ee/development/testing_guide/testing_levels.html#about-controller-tests"
- RESTRICT_ON_SEND =
%i[assigns render_template].freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
36 37 38 |
# File 'lib/rubocop/cop/rspec/rails_controller_testing.rb', line 36 def on_send(node) add_offense(node, message: format(MSG_TEMPLATE, name: node.method_name)) end |