Skip to content

Commit

Permalink
Change sanitize to escape in test names of text_helper_test [#4844 st…
Browse files Browse the repository at this point in the history
…ate:resolved]
  • Loading branch information
rohitarondekar authored and josevalim committed Jun 12, 2010
1 parent 30eaecb commit 7508c0e
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions actionpack/test/template/text_helper_test.rb
Expand Up @@ -40,15 +40,15 @@ def test_simple_format_should_be_html_safe
assert simple_format("<b> test with html tags </b>").html_safe?
end

def test_simple_format_should_sanitize_unsafe_input
def test_simple_format_should_escape_unsafe_input
assert_equal "<p>&lt;b&gt; test with unsafe string &lt;/b&gt;&lt;script&gt;code!&lt;/script&gt;</p>", simple_format("<b> test with unsafe string </b><script>code!</script>")
end

def test_simple_format_should_not_sanitize_input_if_safe_option
def test_simple_format_should_not_escape_input_if_safe_option
assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>", {}, :safe => true)
end

def test_simple_format_should_not_sanitize_safe_input
def test_simple_format_should_not_escape_safe_input
assert_equal "<p><b> test with safe string </b></p>", simple_format("<b> test with safe string </b>".html_safe)
end

Expand All @@ -61,16 +61,16 @@ def test_truncate
assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12)
end

def test_truncate_should_sanitize_unsafe_input
def test_truncate_should_escape_unsafe_input
assert_equal "Hello &lt...", truncate("Hello <script>code!</script>World!!", :length => 12)
end

def test_truncate_should_not_sanitize_input_if_safe_option
def test_truncate_should_not_escape_input_if_safe_option
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!", :length => 12, :safe => true)
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!", :length => 12, :safe => true)
end

def test_truncate_should_not_sanitize_safe_input
def test_truncate_should_not_escape_safe_input
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!".html_safe, :length => 12)
assert_equal "Hello <sc...", truncate("Hello <script>code!</script>World!!".html_safe, :length => 12)
end
Expand Down Expand Up @@ -138,21 +138,21 @@ def test_highlight
assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
end

def test_highlight_should_sanitize_unsafe_input
def test_highlight_should_escape_unsafe_input
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning&lt;script&gt;code!&lt;/script&gt;",
highlight("This is a beautiful morning<script>code!</script>", "beautiful")
)
end

def test_highlight_should_not_sanitize_input_if_safe_option
def test_highlight_should_not_escape_input_if_safe_option
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
highlight("This is a beautiful morning<script>code!</script>", "beautiful", :safe => true)
)
end

def test_highlight_should_not_sanitize_safe_input
def test_highlight_should_not_escape_safe_input
assert_equal(
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
highlight("This is a beautiful morning<script>code!</script>".html_safe, "beautiful")
Expand Down

0 comments on commit 7508c0e

Please sign in to comment.