Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 474e313d02f0c8f9d821efe720bd5242e700233f 1 parent 328a16b
@philipp-kempgen philipp-kempgen authored root committed
Showing with 12 additions and 0 deletions.
  1. +12 −0 activesupport/test/core_ext/string_ext_test.rb
View
12 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"
Please sign in to comment.
Something went wrong with that request. Please try again.