diff options
-rw-r--r-- | activesupport/test/core_ext/string_ext_test.rb | 12 |
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 bb865cae91..38b344b885 100644 --- a/activesupport/test/core_ext/string_ext_test.rb +++ b/activesupport/test/core_ext/string_ext_test.rb @@ -381,6 +381,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<foo>&"'", @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" |