From 474e313d02f0c8f9d821efe720bd5242e700233f Mon Sep 17 00:00:00 2001 From: Philipp Kempgen Date: Tue, 26 Apr 2011 01:04:05 +0200 Subject: test "Escapes special HTML/XML characters" do ... --- activesupport/test/core_ext/string_ext_test.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'activesupport/test') 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 + "&\"'" + @other_combination = @string + "&\"'" + + assert_equal "other<foo>&"'", @combination + assert_equal "hello&\"'", @other_combination + + assert @combination.html_safe? + assert !@other_combination.html_safe? + end + test "Concatting safe onto unsafe yields unsafe" do @other_string = "other" -- cgit v1.2.3