aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller/routing_test.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2017-08-01 16:59:37 -0500
committerDavid Heinemeier Hansson <david@loudthinking.com>2017-08-01 16:59:37 -0500
commite473946d58cfdab0b16cf91cdad6bef23fcfafc3 (patch)
tree8381b3ddd0fca7ef6e9cb7f79aa53a768ecbf376 /actionpack/test/controller/routing_test.rb
parent3d3ec20a485a109bb772cb37382040e25f5d0ded (diff)
parentf9a43f28c087f8ffd35ff7c33a60c938b60f2be2 (diff)
downloadrails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.tar.gz
rails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.tar.bz2
rails-e473946d58cfdab0b16cf91cdad6bef23fcfafc3.zip
Merge branch 'master' into active-storage-import
Diffstat (limited to 'actionpack/test/controller/routing_test.rb')
-rw-r--r--actionpack/test/controller/routing_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/controller/routing_test.rb b/actionpack/test/controller/routing_test.rb
index fefb84e095..f09051b306 100644
--- a/actionpack/test/controller/routing_test.rb
+++ b/actionpack/test/controller/routing_test.rb
@@ -96,6 +96,22 @@ class LegacyRouteSetTests < ActiveSupport::TestCase
assert_equal({ "artist" => "journey", "song" => "faithfully" }, hash)
end
+ def test_id_encoding
+ rs.draw do
+ get "/journey/:id", to: lambda { |env|
+ param = ActionDispatch::Request.new(env).path_parameters
+ resp = ActiveSupport::JSON.encode param
+ [200, {}, [resp]]
+ }
+ end
+
+ # The encoding of the URL in production is *binary*, so we add a
+ # .b here.
+ hash = ActiveSupport::JSON.decode get(URI("http://example.org/journey/%E5%A4%AA%E9%83%8E".b))
+ assert_equal({ "id" => "太郎" }, hash)
+ assert_equal ::Encoding::UTF_8, hash["id"].encoding
+ end
+
def test_id_with_dash
rs.draw do
get "/journey/:id", to: lambda { |env|