diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb
index 4c76e9642fe3d..19f55143bfb2c 100644
--- a/actionpack/lib/action_view/helpers/text_helper.rb
+++ b/actionpack/lib/action_view/helpers/text_helper.rb
@@ -275,7 +275,7 @@ def textilize(text, *options)
# textilize_without_paragraph("Visit the Rails website "here":http://www.rubyonrails.org/.)
# # => "Visit the Rails website here."
def textilize_without_paragraph(text, *options)
- textiled = textilize(text, options)
+ textiled = textilize(text, *options)
if textiled[0..2] == "
" then textiled = textiled[3..-1] end
if textiled[-4..-1] == "
" then textiled = textiled[0..-5] end
return textiled
diff --git a/actionpack/test/template/text_helper_test.rb b/actionpack/test/template/text_helper_test.rb
index 9d7106b2e5301..8c4711451e3d1 100644
--- a/actionpack/test/template/text_helper_test.rb
+++ b/actionpack/test/template/text_helper_test.rb
@@ -693,5 +693,37 @@ def test_textilize_should_not_sanitize_safe_input
def test_textilize_with_hard_breaks
assert_equal("This is one scary world.
\n True.
", textilize("This is one scary world.\n True."))
end
+
+ def test_textilize_without_paragraph_should_be_html_safe
+ textilize_without_paragraph("*This is Textile!* Rejoice!").html_safe?
+ end
+
+ def test_textilize_without_paragraph
+ assert_equal("This is Textile! Rejoice!", textilize_without_paragraph("*This is Textile!* Rejoice!"))
+ end
+
+ def test_textilize_without_paragraph_with_blank
+ assert_equal("", textilize_without_paragraph(""))
+ end
+
+ def test_textilize_without_paragraph_with_options
+ assert_equal("This is worded <strong>strongly</strong>", textilize_without_paragraph("This is worded strongly", :filter_html))
+ end
+
+ def test_textilize_without_paragraph_should_sanitize_unsafe_input
+ assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly"))
+ end
+
+ def test_textilize_without_paragraph_should_not_sanitize_input_if_safe_option
+ assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly", :safe))
+ end
+
+ def test_textilize_without_paragraph_should_not_sanitize_safe_input
+ assert_equal("This is worded strongly", textilize_without_paragraph("This is worded strongly".html_safe))
+ end
+
+ def test_textilize_without_paragraph_with_hard_breaks
+ assert_equal("This is one scary world.
\n True.", textilize_without_paragraph("This is one scary world.\n True."))
+ end
end
end