diff options
Diffstat (limited to 'activesupport/test/core_ext/array_ext_test.rb')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 01b243cdb5..93f4482307 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -55,21 +55,22 @@ class ArrayExtToSentenceTests < Test::Unit::TestCase assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence end - def test_to_sentence_with_connector - assert_equal "one, two, and also three", ['one', 'two', 'three'].to_sentence(:connector => 'and also') - assert_equal "one, two, three", ['one', 'two', 'three'].to_sentence(:connector => '') - assert_equal "one, two, three", ['one', 'two', 'three'].to_sentence(:connector => nil) - assert_equal "one, two, three", ['one', 'two', 'three'].to_sentence(:connector => ' ') - assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence(:connector => 'and ') + def test_to_sentence_with_words_connector + assert_equal "one two, and three", ['one', 'two', 'three'].to_sentence(:words_connector => ' ') + assert_equal "one & two, and three", ['one', 'two', 'three'].to_sentence(:words_connector => ' & ') + assert_equal "onetwo, and three", ['one', 'two', 'three'].to_sentence(:words_connector => nil) end - def test_to_sentence_with_skip_last_comma - assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence(:skip_last_comma => false) + def test_to_sentence_with_last_word_connector + assert_equal "one, two, and also three", ['one', 'two', 'three'].to_sentence(:last_word_connector => ', and also ') + assert_equal "one, twothree", ['one', 'two', 'three'].to_sentence(:last_word_connector => nil) + assert_equal "one, two three", ['one', 'two', 'three'].to_sentence(:last_word_connector => ' ') + assert_equal "one, two and three", ['one', 'two', 'three'].to_sentence(:last_word_connector => ' and ') end def test_two_elements assert_equal "one and two", ['one', 'two'].to_sentence - assert_equal "one two", ['one', 'two'].to_sentence(:connector => '') + assert_equal "one two", ['one', 'two'].to_sentence(:two_words_connector => ' ') end def test_one_element |