Closed
Description
Defining a controller in a test/spec and adding a route for that controller within the test/spec will result in this rule to be picked up incorrectly.
Example:
require 'rails_helper'
module Admin
RSpec.describe AdminController do
controller do
def test
render plain: 'test'
end
end
before do
@routes.draw do
get '/test', to: 'admin/admin#test'
end
get '/test'
end
# ...
end
end
Expected behavior
The defined route should not be complained about by this rule.
Actual behavior
Rubocop complains with:
spec/controllers/admin/admin_controller_spec.rb:18:9: C: Rails/HttpPositionalArguments: Use keyword arguments instead of positional arguments for http call: get.
get '/test', to: 'admin/admin#test'
^^^
RuboCop version
0.78.0 (using Parser 2.7.0.0, running on ruby 2.5.3 x86_64-linux)
Activity