mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Change sanitize to escape in test names of text_helper_test [#4844 state:resolved]
This commit is contained in:
parent
30eaecb3df
commit
7508c0e9d3
1 changed files with 9 additions and 9 deletions
|
@ -40,15 +40,15 @@ class TextHelperTest < ActionView::TestCase
|
||||||
assert simple_format("<b> test with html tags </b>").html_safe?
|
assert simple_format("<b> test with html tags </b>").html_safe?
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_simple_format_should_sanitize_unsafe_input
|
def test_simple_format_should_escape_unsafe_input
|
||||||
assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>")
|
assert_equal "<p><b> test with unsafe string </b><script>code!</script></p>", simple_format("<b> test with unsafe string </b><script>code!</script>")
|
||||||
end
|
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)
|
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
|
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)
|
assert_equal "<p><b> test with safe string </b></p>", simple_format("<b> test with safe string </b>".html_safe)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -61,16 +61,16 @@ class TextHelperTest < ActionView::TestCase
|
||||||
assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12)
|
assert_equal "Hello Wor...", truncate("Hello World!!", :length => 12)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_truncate_should_sanitize_unsafe_input
|
def test_truncate_should_escape_unsafe_input
|
||||||
assert_equal "Hello <...", truncate("Hello <script>code!</script>World!!", :length => 12)
|
assert_equal "Hello <...", truncate("Hello <script>code!</script>World!!", :length => 12)
|
||||||
end
|
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)
|
||||||
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
|
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)
|
||||||
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
|
end
|
||||||
|
@ -138,21 +138,21 @@ class TextHelperTest < ActionView::TestCase
|
||||||
assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
|
assert_equal ' ', highlight(' ', 'blank text is returned verbatim')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_highlight_should_sanitize_unsafe_input
|
def test_highlight_should_escape_unsafe_input
|
||||||
assert_equal(
|
assert_equal(
|
||||||
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
||||||
highlight("This is a beautiful morning<script>code!</script>", "beautiful")
|
highlight("This is a beautiful morning<script>code!</script>", "beautiful")
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_highlight_should_not_sanitize_input_if_safe_option
|
def test_highlight_should_not_escape_input_if_safe_option
|
||||||
assert_equal(
|
assert_equal(
|
||||||
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
||||||
highlight("This is a beautiful morning<script>code!</script>", "beautiful", :safe => true)
|
highlight("This is a beautiful morning<script>code!</script>", "beautiful", :safe => true)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_highlight_should_not_sanitize_safe_input
|
def test_highlight_should_not_escape_safe_input
|
||||||
assert_equal(
|
assert_equal(
|
||||||
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
"This is a <strong class=\"highlight\">beautiful</strong> morning<script>code!</script>",
|
||||||
highlight("This is a beautiful morning<script>code!</script>".html_safe, "beautiful")
|
highlight("This is a beautiful morning<script>code!</script>".html_safe, "beautiful")
|
||||||
|
|
Loading…
Reference in a new issue