aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-06-09 15:29:17 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-06-09 15:29:17 -0700
commit0b02284545dcbed7da40489e0db9bd49eca924b1 (patch)
tree4b0d4dc0a79b294e7a612c3e0a3256ba2592d60d /actionpack
parent84f71e42b79f00a97e95f6f472903b553ceda8ef (diff)
downloadrails-0b02284545dcbed7da40489e0db9bd49eca924b1.tar.gz
rails-0b02284545dcbed7da40489e0db9bd49eca924b1.tar.bz2
rails-0b02284545dcbed7da40489e0db9bd49eca924b1.zip
ensuring that json_escape returns html safe strings when passed an html safe string
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/template/erb_util_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/template/erb_util_test.rb b/actionpack/test/template/erb_util_test.rb
index 30f6d1a213..790ab1c74c 100644
--- a/actionpack/test/template/erb_util_test.rb
+++ b/actionpack/test/template/erb_util_test.rb
@@ -16,6 +16,16 @@ class ErbUtilTest < Test::Unit::TestCase
end
end
+ def test_json_escape_returns_unsafe_strings_when_passed_unsafe_strings
+ value = json_escape("asdf")
+ assert !value.html_safe?
+ end
+
+ def test_json_escape_returns_safe_strings_when_passed_safe_strings
+ value = json_escape("asdf".html_safe)
+ assert value.html_safe?
+ end
+
def test_html_escape_is_html_safe
escaped = h("<p>")
assert_equal "&lt;p&gt;", escaped