diff options
author | Matthew Draper <matthew@trebex.net> | 2017-07-10 00:07:03 +0930 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-10 00:07:03 +0930 |
commit | 551f88366dcbaed3b0abc89bddd63975c4c9a5ca (patch) | |
tree | ab9306fac3d48ff7dc8556076c8d07b38bcfc381 /actionpack/test | |
parent | 8d98bb0cc6e2baf1694971ae2bdf19e8b8bcdce5 (diff) | |
parent | b3f3d49fd6b91c6573b3e10e3d00f65306638927 (diff) | |
download | rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.tar.gz rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.tar.bz2 rails-551f88366dcbaed3b0abc89bddd63975c4c9a5ca.zip |
Merge pull request #29655 from kirs/frozen-friendly-ap-ar
Prepare AP and AR to be frozen string friendly
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/abstract_unit.rb | 3 | ||||
-rw-r--r-- | actionpack/test/controller/routing_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/dispatch/debug_exceptions_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/dispatch/prefix_generation_test.rb | 3 | ||||
-rw-r--r-- | actionpack/test/dispatch/static_test.rb | 5 | ||||
-rw-r--r-- | actionpack/test/journey/router/utils_test.rb | 3 |
6 files changed, 13 insertions, 7 deletions
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb index bd118b46be..9a337803cb 100644 --- a/actionpack/test/abstract_unit.rb +++ b/actionpack/test/abstract_unit.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true $:.unshift File.expand_path("lib", __dir__) $:.unshift File.expand_path("fixtures/helpers", __dir__) $:.unshift File.expand_path("fixtures/alternate_helpers", __dir__) @@ -175,7 +176,7 @@ end class Rack::TestCase < ActionDispatch::IntegrationTest def self.testing(klass = nil) if klass - @testing = "/#{klass.name.underscore}".sub!(/_controller$/, "") + @testing = "/#{klass.name.underscore}".sub(/_controller$/, "") else @testing end diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb index 56b39510bb..40401cbc95 100644 --- a/actionpack/test/controller/routing_test.rb +++ b/actionpack/test/controller/routing_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "controller/fake_controllers" require "active_support/core_ext/object/with_options" @@ -656,7 +657,7 @@ class LegacyRouteSetTests < ActiveSupport::TestCase assert_equal "/page/foo", url_for(rs, controller: "content", action: "show_page", id: "foo") assert_equal({ controller: "content", action: "show_page", id: "foo" }, rs.recognize_path("/page/foo")) - token = "\321\202\320\265\320\272\321\201\321\202" # 'text' in Russian + token = "\321\202\320\265\320\272\321\201\321\202".dup # 'text' in Russian token.force_encoding(Encoding::BINARY) escaped_token = CGI::escape(token) diff --git a/actionpack/test/dispatch/debug_exceptions_test.rb b/actionpack/test/dispatch/debug_exceptions_test.rb index ea477e8908..bf07410d0d 100644 --- a/actionpack/test/dispatch/debug_exceptions_test.rb +++ b/actionpack/test/dispatch/debug_exceptions_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" class DebugExceptionsTest < ActionDispatch::IntegrationTest @@ -344,7 +345,7 @@ class DebugExceptionsTest < ActionDispatch::IntegrationTest }) assert_response 500 - assert_includes(body, CGI.escapeHTML(PP.pp(params, "", 200))) + assert_includes(body, CGI.escapeHTML(PP.pp(params, "".dup, 200))) end test "sets the HTTP charset parameter" do diff --git a/actionpack/test/dispatch/prefix_generation_test.rb b/actionpack/test/dispatch/prefix_generation_test.rb index 0e093d2188..3cd9344c04 100644 --- a/actionpack/test/dispatch/prefix_generation_test.rb +++ b/actionpack/test/dispatch/prefix_generation_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "rack/test" require "rails/engine" @@ -11,7 +12,7 @@ module TestGenerationPrefix end def self.model_name - klass = "Post" + klass = "Post".dup def klass.name; self end ActiveModel::Name.new(klass) diff --git a/actionpack/test/dispatch/static_test.rb b/actionpack/test/dispatch/static_test.rb index 3082d1072b..50780a1dd0 100644 --- a/actionpack/test/dispatch/static_test.rb +++ b/actionpack/test/dispatch/static_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" require "zlib" @@ -29,7 +30,7 @@ module StaticTests end def test_handles_urls_with_ascii_8bit - assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding("ASCII-8BIT")).body + assert_equal "Hello, World!", get("/doorkeeper%E3E4".dup.force_encoding("ASCII-8BIT")).body end def test_handles_urls_with_ascii_8bit_on_win_31j @@ -37,7 +38,7 @@ module StaticTests Encoding.default_internal = "Windows-31J" Encoding.default_external = "Windows-31J" end - assert_equal "Hello, World!", get("/doorkeeper%E3E4".force_encoding("ASCII-8BIT")).body + assert_equal "Hello, World!", get("/doorkeeper%E3E4".dup.force_encoding("ASCII-8BIT")).body end def test_handles_urls_with_null_byte diff --git a/actionpack/test/journey/router/utils_test.rb b/actionpack/test/journey/router/utils_test.rb index 74277a4325..a69b606b01 100644 --- a/actionpack/test/journey/router/utils_test.rb +++ b/actionpack/test/journey/router/utils_test.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require "abstract_unit" module ActionDispatch @@ -21,7 +22,7 @@ module ActionDispatch end def test_uri_unescape_with_utf8_string - assert_equal "Šašinková", Utils.unescape_uri("%C5%A0a%C5%A1inkov%C3%A1".force_encoding(Encoding::US_ASCII)) + assert_equal "Šašinková", Utils.unescape_uri("%C5%A0a%C5%A1inkov%C3%A1".dup.force_encoding(Encoding::US_ASCII)) end def test_normalize_path_not_greedy |