diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-07-24 21:06:11 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-24 21:06:11 -0400 |
commit | 65f861ee1e8cdeec1533c565f949d05cf8195965 (patch) | |
tree | 57daa14bcb349a1b2c531d28f521def17aed4f84 /actionpack/test | |
parent | 7d133b23b6a366de3658c4e1c6af546e611de728 (diff) | |
parent | c0e2cfdc3fd476e229ede5cda59dea6374a730e7 (diff) | |
download | rails-65f861ee1e8cdeec1533c565f949d05cf8195965.tar.gz rails-65f861ee1e8cdeec1533c565f949d05cf8195965.tar.bz2 rails-65f861ee1e8cdeec1533c565f949d05cf8195965.zip |
Merge pull request #29919 from kirs/actionpack-frozen-friendly
Make actionpack frozen string friendly
Diffstat (limited to 'actionpack/test')
7 files changed, 22 insertions, 8 deletions
diff --git a/actionpack/test/abstract/callbacks_test.rb b/actionpack/test/abstract/callbacks_test.rb index 9c2261bf76..fdc09bd951 100644 --- a/actionpack/test/abstract/callbacks_test.rb +++ b/actionpack/test/abstract/callbacks_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" module AbstractController @@ -42,7 +44,7 @@ module AbstractController def aroundz @aroundz = "FIRST" yield - @aroundz << "SECOND" + @aroundz += "SECOND" end def index diff --git a/actionpack/test/controller/filters_test.rb b/actionpack/test/controller/filters_test.rb index 5f1463cfa8..9f0a9dec7a 100644 --- a/actionpack/test/controller/filters_test.rb +++ b/actionpack/test/controller/filters_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" class ActionController::Base @@ -346,7 +348,7 @@ class FilterTest < ActionController::TestCase class AroundFilter def before(controller) @execution_log = "before" - controller.class.execution_log << " before aroundfilter " if controller.respond_to? :execution_log + controller.class.execution_log += " before aroundfilter " if controller.respond_to? :execution_log controller.instance_variable_set(:"@before_ran", true) end diff --git a/actionpack/test/controller/helper_test.rb b/actionpack/test/controller/helper_test.rb index 03dbd63614..de8072a994 100644 --- a/actionpack/test/controller/helper_test.rb +++ b/actionpack/test/controller/helper_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" ActionController::Base.helpers_path = File.expand_path("../fixtures/helpers", __dir__) @@ -106,7 +108,7 @@ class HelperTest < ActiveSupport::TestCase def setup # Increment symbol counter. - @symbol = (@@counter ||= "A0").succ!.dup + @symbol = (@@counter ||= "A0").succ.dup # Generate new controller class. controller_class_name = "Helper#{@symbol}Controller" diff --git a/actionpack/test/controller/http_token_authentication_test.rb b/actionpack/test/controller/http_token_authentication_test.rb index 09d2793c9a..672aa1351c 100644 --- a/actionpack/test/controller/http_token_authentication_test.rb +++ b/actionpack/test/controller/http_token_authentication_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" class HttpTokenAuthenticationTest < ActionController::TestCase @@ -148,7 +150,7 @@ class HttpTokenAuthenticationTest < ActionController::TestCase end test "token_and_options returns empty string with empty token" do - token = "" + token = "".dup actual = ActionController::HttpAuthentication::Token.token_and_options(sample_request(token)).first expected = token assert_equal(expected, actual) diff --git a/actionpack/test/controller/new_base/bare_metal_test.rb b/actionpack/test/controller/new_base/bare_metal_test.rb index 054757fab3..b049022a06 100644 --- a/actionpack/test/controller/new_base/bare_metal_test.rb +++ b/actionpack/test/controller/new_base/bare_metal_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" module BareMetalTest @@ -11,7 +13,7 @@ module BareMetalTest test "response body is a Rack-compatible response" do status, headers, body = BareController.action(:index).call(Rack::MockRequest.env_for("/")) assert_equal 200, status - string = "" + string = "".dup body.each do |part| assert part.is_a?(String), "Each part of the body must be a String" diff --git a/actionpack/test/controller/new_base/middleware_test.rb b/actionpack/test/controller/new_base/middleware_test.rb index 0493291c03..df69650a7b 100644 --- a/actionpack/test/controller/new_base/middleware_test.rb +++ b/actionpack/test/controller/new_base/middleware_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" module MiddlewareTest @@ -21,7 +23,7 @@ module MiddlewareTest def call(env) result = @app.call(env) - result[1]["Middleware-Order"] << "!" + result[1]["Middleware-Order"] += "!" result end end diff --git a/actionpack/test/controller/webservice_test.rb b/actionpack/test/controller/webservice_test.rb index 6f97a4b62e..4a10637b54 100644 --- a/actionpack/test/controller/webservice_test.rb +++ b/actionpack/test/controller/webservice_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "abstract_unit" require "active_support/json/decoding" @@ -21,8 +23,8 @@ class WebServiceTest < ActionDispatch::IntegrationTest value = "" end - s << ", " unless s.empty? - s << "#{k}#{value}" + s += ", " unless s.empty? + s += "#{k}#{value}" end end end |