diff options
author | Richard Schneeman <richard.schneeman+no-recruiters@gmail.com> | 2018-07-25 16:00:33 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-25 16:00:33 -0500 |
commit | 91fd679710118482f718ea710710561f1cfb0b70 (patch) | |
tree | 9169aa6ea2315b16f77e530dd2c6a4eda1816769 /actionpack/test | |
parent | ab8847c92092a57df6433f4fc72682074359531f (diff) | |
parent | d108288c2f684233298f97f18ac00de0b016deaa (diff) | |
download | rails-91fd679710118482f718ea710710561f1cfb0b70.tar.gz rails-91fd679710118482f718ea710710561f1cfb0b70.tar.bz2 rails-91fd679710118482f718ea710710561f1cfb0b70.zip |
Merge pull request #32381 from q-centrix/update-codeclimate-configs
Turn on performance based cops
Diffstat (limited to 'actionpack/test')
4 files changed, 9 insertions, 7 deletions
diff --git a/actionpack/test/controller/http_digest_authentication_test.rb b/actionpack/test/controller/http_digest_authentication_test.rb index 3f211cd60d..b133afb343 100644 --- a/actionpack/test/controller/http_digest_authentication_test.rb +++ b/actionpack/test/controller/http_digest_authentication_test.rb @@ -272,7 +272,7 @@ class HttpDigestAuthenticationTest < ActionController::TestCase credentials.merge!(options) path_info = @request.env["PATH_INFO"].to_s uri = options[:uri] || path_info - credentials.merge!(uri: uri) + credentials[:uri] = uri @request.env["ORIGINAL_FULLPATH"] = path_info ActionController::HttpAuthentication::Digest.encode_credentials(method, credentials, password, options[:password_is_ha1]) end diff --git a/actionpack/test/controller/log_subscriber_test.rb b/actionpack/test/controller/log_subscriber_test.rb index be455642de..0562c16284 100644 --- a/actionpack/test/controller/log_subscriber_test.rb +++ b/actionpack/test/controller/log_subscriber_test.rb @@ -82,9 +82,7 @@ module Another @last_payload = payload end - def last_payload - @last_payload - end + attr_reader :last_payload end end diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb index 3688fdbeee..d336b96eff 100644 --- a/actionpack/test/controller/resources_test.rb +++ b/actionpack/test/controller/resources_test.rb @@ -1322,7 +1322,7 @@ class ResourcesTest < ActionController::TestCase def assert_resource_allowed_routes(controller, options, shallow_options, allowed, not_allowed, path = controller) shallow_path = "#{path}/#{shallow_options[:id]}" format = options[:format] && ".#{options[:format]}" - options.merge!(controller: controller) + options[:controller] = controller shallow_options.merge!(options) assert_whether_allowed(allowed, not_allowed, options, "index", "#{path}#{format}", :get) @@ -1336,7 +1336,7 @@ class ResourcesTest < ActionController::TestCase def assert_singleton_resource_allowed_routes(controller, options, allowed, not_allowed, path = controller.singularize) format = options[:format] && ".#{options[:format]}" - options.merge!(controller: controller) + options[:controller] = controller assert_whether_allowed(allowed, not_allowed, options, "new", "#{path}/new#{format}", :get) assert_whether_allowed(allowed, not_allowed, options, "create", "#{path}#{format}", :post) diff --git a/actionpack/test/dispatch/header_test.rb b/actionpack/test/dispatch/header_test.rb index 3a265a056b..43e63eb996 100644 --- a/actionpack/test/dispatch/header_test.rb +++ b/actionpack/test/dispatch/header_test.rb @@ -105,16 +105,20 @@ 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) @@ -156,7 +160,7 @@ class HeaderTest < ActiveSupport::TestCase env = { "HTTP_REFERER" => "/" } headers = make_headers(env) headers["Referer"] = "http://example.com/" - headers.merge! "CONTENT_TYPE" => "text/plain" + headers["CONTENT_TYPE"] = "text/plain" assert_equal({ "HTTP_REFERER" => "http://example.com/", "CONTENT_TYPE" => "text/plain" }, env) end |