From 2f3390750d50fc9cfecbd11f48e5226b4cc3077e Mon Sep 17 00:00:00 2001 From: Alberto Grespan Date: Mon, 19 May 2014 18:45:47 -0430 Subject: [PATCH] Add tests to validate encoding of URLs Added tests to validate the encoding of returned URL strings after been escaped or unescaped. --- test/test_post.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/test_post.rb b/test/test_post.rb index e3fa9535..daa0a038 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -100,6 +100,14 @@ class TestPost < Test::Unit::TestCase assert_equal "/2014/03/22/escape-+ %20[]", @post.id end + should "return a UTF-8 escaped string" do + assert_equal Encoding::UTF_8, URL.escape_path("/rails笔记/2014/04/20/escaped/").encoding + end + + should "return a UTF-8 unescaped string" do + assert_equal Encoding::UTF_8, URL.unescape_path("/rails%E7%AC%94%E8%AE%B0/2014/04/20/escaped/").encoding + end + should "respect permalink in yaml front matter" do file = "2008-12-03-permalinked-post.textile" @post.process(file)