Permalink
Browse files

test "Escapes special HTML/XML characters" do ...

  • Loading branch information...
philipp-kempgen authored and root committed Apr 25, 2011
1 parent 328a16b commit 474e313d02f0c8f9d821efe720bd5242e700233f
Showing with 12 additions and 0 deletions.
  1. +12 −0 activesupport/test/core_ext/string_ext_test.rb
@@ -381,6 +381,18 @@ def to_s
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"

0 comments on commit 474e313

Please sign in to comment.