aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/string_ext_test.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2011-05-07 03:41:26 -0700
committerJosé Valim <jose.valim@gmail.com>2011-05-07 03:41:26 -0700
commitaaf01cd53718c8aa5b69ac056b997e6dd9893777 (patch)
tree8541f3d2d89d0646d02311ce16cc063143107d7f /activesupport/test/core_ext/string_ext_test.rb
parent9cc18c52faeebaad6a76bd62cdca1c6b9f96afed (diff)
parent474e313d02f0c8f9d821efe720bd5242e700233f (diff)
downloadrails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.tar.gz
rails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.tar.bz2
rails-aaf01cd53718c8aa5b69ac056b997e6dd9893777.zip
Merge pull request #275 from pk-amooma/master
properly escape "'" to "'" for XML
Diffstat (limited to 'activesupport/test/core_ext/string_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/string_ext_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/string_ext_test.rb b/activesupport/test/core_ext/string_ext_test.rb
index 32675c884a..54ef68c59b 100644
--- a/activesupport/test/core_ext/string_ext_test.rb
+++ b/activesupport/test/core_ext/string_ext_test.rb
@@ -387,6 +387,18 @@ class OutputSafetyTest < ActiveSupport::TestCase
assert !@other_combination.html_safe?
end
+ test "Escapes special HTML/XML characters" do
+ @other_string = "other".html_safe
+ @combination = @other_string + "<foo>&\"'"
+ @other_combination = @string + "<foo>&\"'"
+
+ assert_equal "other&lt;foo&gt;&amp;&quot;&apos;", @combination
+ assert_equal "hello<foo>&\"'", @other_combination
+
+ assert @combination.html_safe?
+ assert !@other_combination.html_safe?
+ end
+
test "Concatting safe onto unsafe yields unsafe" do
@other_string = "other"