From aa8ebea143bbaf548d3c55580533c9668cacfcc7 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 25 Jan 2012 09:22:19 -0800 Subject: Merge pull request #4658 from pwim/unicode-paths Test for unicode path support --- actionpack/test/dispatch/routing_test.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'actionpack/test') diff --git a/actionpack/test/dispatch/routing_test.rb b/actionpack/test/dispatch/routing_test.rb index 8f843eb960..3689b17877 100644 --- a/actionpack/test/dispatch/routing_test.rb +++ b/actionpack/test/dispatch/routing_test.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 require 'erb' require 'abstract_unit' require 'controller/fake_controllers' @@ -2544,3 +2545,22 @@ class TestUriPathEscaping < ActionDispatch::IntegrationTest assert_equal 'a b/c+d', @response.body end end + +class TestUnicodePaths < ActionDispatch::IntegrationTest + Routes = ActionDispatch::Routing::RouteSet.new.tap do |app| + app.draw do + match "/#{Rack::Utils.escape("ほげ")}" => lambda { |env| + path_params = env['action_dispatch.request.path_parameters'] + [200, { 'Content-Type' => 'text/plain' }, []] + }, :as => :unicode_path + end + end + + include Routes.url_helpers + def app; Routes end + + test 'recognizes unicode path' do + get "/#{Rack::Utils.escape("ほげ")}" + assert_equal "200", @response.code + end +end -- cgit v1.2.3