Class: Gitlab::Styles::Rubocop::Cop::RSpec::HaveLinkParameters
- Inherits:
-
Base
- Object
- RuboCop::Cop::RSpec::Base
- Base
- Gitlab::Styles::Rubocop::Cop::RSpec::HaveLinkParameters
- Extended by:
- RuboCop::Cop::AutoCorrector
- Defined in:
- lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb
Overview
This cop checks for unused parameters to the ‘have_link` matcher.
Constant Summary collapse
- MESSAGE =
"The second argument to `have_link` should be a Hash."
Constants included from Rspec::Helpers
Rspec::Helpers::LET, Rspec::Helpers::LET_IT_BE_HELPERS
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gitlab/styles/rubocop/cop/rspec/have_link_parameters.rb', line 32 def on_send(node) return unless unused_parameters?(node) location = node.arguments[1..] .map(&:source_range) .reduce(:join) add_offense(location, message: MESSAGE) do |corrector| corrector.insert_after(location.end, "\n") end end |