2012-12-19 15:54:47 -05:00
|
|
|
require 'abstract_unit'
|
|
|
|
|
|
|
|
module ActionDispatch
|
|
|
|
module Journey
|
|
|
|
class Router
|
2012-12-31 12:36:30 -05:00
|
|
|
class TestUtils < ActiveSupport::TestCase
|
2012-12-19 15:54:47 -05:00
|
|
|
def test_path_escape
|
2014-04-07 02:34:21 -04:00
|
|
|
assert_equal "a/b%20c+d%25", Utils.escape_path("a/b c+d%")
|
2012-12-19 15:54:47 -05:00
|
|
|
end
|
|
|
|
|
2014-04-20 05:08:32 -04:00
|
|
|
def test_segment_escape
|
|
|
|
assert_equal "a%2Fb%20c+d%25", Utils.escape_segment("a/b c+d%")
|
|
|
|
end
|
|
|
|
|
2012-12-19 15:54:47 -05:00
|
|
|
def test_fragment_escape
|
2014-04-07 02:34:21 -04:00
|
|
|
assert_equal "a/b%20c+d%25?e", Utils.escape_fragment("a/b c+d%?e")
|
2012-12-19 15:54:47 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_uri_unescape
|
|
|
|
assert_equal "a/b c+d", Utils.unescape_uri("a%2Fb%20c+d")
|
|
|
|
end
|
2013-10-23 17:44:23 -04:00
|
|
|
|
|
|
|
def test_normalize_path_not_greedy
|
|
|
|
assert_equal "/foo%20bar%20baz", Utils.normalize_path("/foo%20bar%20baz")
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_normalize_path_uppercase
|
|
|
|
assert_equal "/foo%AAbar%AAbaz", Utils.normalize_path("/foo%aabar%aabaz")
|
|
|
|
end
|
2012-12-19 15:54:47 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|