Remove Rubocop's comments from Rails code base

PR#32381 added Rubocop's comments to some tests files in order to
exclude `Performance/RedundantMerge`.

Turn off `Performance` cops for tests files via `Exclude`
in `.rubocop.yml`.

Context https://github.com/rails/rails/pull/32381#discussion_r205212331
This commit is contained in:
bogdanvlviv 2018-07-26 11:33:49 +03:00
parent f0c917c7d4
commit 09ec075f1e
No known key found for this signature in database
GPG Key ID: E4ACD76A6DB6DFDD
3 changed files with 5 additions and 5 deletions

View File

@ -9,6 +9,10 @@ AllCops:
- 'actionpack/lib/action_dispatch/journey/parser.rb'
- 'railties/test/fixtures/tmp/**/*'
Performance:
Exclude:
- '**/test/**/*'
Rails:
Enabled: true

View File

@ -105,20 +105,16 @@ class HeaderTest < ActiveSupport::TestCase
end
test "#merge! headers with mutation" do
# rubocop:disable Performance/RedundantMerge
@headers.merge!("Host" => "http://example.test",
"Content-Type" => "text/html")
# rubocop:enable Performance/RedundantMerge
assert_equal({ "HTTP_HOST" => "http://example.test",
"CONTENT_TYPE" => "text/html",
"HTTP_REFERER" => "/some/page" }, @headers.env)
end
test "#merge! env with mutation" do
# rubocop:disable Performance/RedundantMerge
@headers.merge!("HTTP_HOST" => "http://first.com",
"CONTENT_TYPE" => "text/html")
# rubocop:enable Performance/RedundantMerge
assert_equal({ "HTTP_HOST" => "http://first.com",
"CONTENT_TYPE" => "text/html",
"HTTP_REFERER" => "/some/page" }, @headers.env)

View File

@ -187,7 +187,7 @@ module ActiveRecord
end
relation = Relation.new(klass)
relation.merge!(where: ["foo = ?", "bar"]) # rubocop:disable Performance/RedundantMerge
relation.merge!(where: ["foo = ?", "bar"])
assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
end