Skip to content

Commit aa8ebea

Browse files
committed
Merge pull request rails#4658 from pwim/unicode-paths
Test for unicode path support
1 parent 0581c1a commit aa8ebea

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

actionpack/test/dispatch/routing_test.rb

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# encoding: UTF-8
12
require 'erb'
23
require 'abstract_unit'
34
require 'controller/fake_controllers'
@@ -2544,3 +2545,22 @@ def app; Routes end
25442545
assert_equal 'a b/c+d', @response.body
25452546
end
25462547
end
2548+
2549+
class TestUnicodePaths < ActionDispatch::IntegrationTest
2550+
Routes = ActionDispatch::Routing::RouteSet.new.tap do |app|
2551+
app.draw do
2552+
match "/#{Rack::Utils.escape("ほげ")}" => lambda { |env|
2553+
path_params = env['action_dispatch.request.path_parameters']
2554+
[200, { 'Content-Type' => 'text/plain' }, []]
2555+
}, :as => :unicode_path
2556+
end
2557+
end
2558+
2559+
include Routes.url_helpers
2560+
def app; Routes end
2561+
2562+
test 'recognizes unicode path' do
2563+
get "/#{Rack::Utils.escape("ほげ")}"
2564+
assert_equal "200", @response.code
2565+
end
2566+
end

0 commit comments

Comments
 (0)