aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/text_helper_test.rb
diff options
context:
space:
mode:
authorMauricio Gomez Aguinaga <mgomezaguinaga@groupon.com>2015-08-11 14:15:47 -0700
committerMauricio Gomez Aguinaga <mgomezaguinaga@groupon.com>2015-08-11 14:15:47 -0700
commitcf93c6ae48cad47fda5c864c8b7b232f88bec088 (patch)
treef2d488df3d876f1503cbec7e5776a50147d08a02 /actionview/test/template/text_helper_test.rb
parentc18f81975c36961b053224c7aad4bce737373601 (diff)
downloadrails-cf93c6ae48cad47fda5c864c8b7b232f88bec088.tar.gz
rails-cf93c6ae48cad47fda5c864c8b7b232f88bec088.tar.bz2
rails-cf93c6ae48cad47fda5c864c8b7b232f88bec088.zip
Sometimes you need a specific break sequence while using word wrap and as today the only option we have is "\n" and is hardcoded.
With this change you will be able to specify any break sequence ("\r\n" for example) as an option. adding proper documentation for break_sequence in ActionView::Helpers::TextHelper.word_wrap adding some more documentation for word_wrap custom break sequence and making sure we use new hash syntax
Diffstat (limited to 'actionview/test/template/text_helper_test.rb')
-rw-r--r--actionview/test/template/text_helper_test.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/actionview/test/template/text_helper_test.rb b/actionview/test/template/text_helper_test.rb
index 5791f33069..fae1965ffa 100644
--- a/actionview/test/template/text_helper_test.rb
+++ b/actionview/test/template/text_helper_test.rb
@@ -366,6 +366,10 @@ class TextHelperTest < ActionView::TestCase
assert_equal options, passed_options
end
+ def test_word_wrap_with_custom_break_sequence
+ assert_equal("1234567890\r\n1234567890\r\n1234567890", word_wrap("1234567890 " * 3, line_width: 2, break_sequence: "\r\n"))
+ end
+
def test_pluralization
assert_equal("1 count", pluralize(1, "count"))
assert_equal("2 counts", pluralize(2, "count"))