diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-11 06:14:05 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-09-11 06:14:05 +0000 |
commit | fe4abaa7df98aa736485b6ac863d05d80d2c1d89 (patch) | |
tree | b7149cf54b63e008b667e266ccbe164041a83686 /activesupport/test | |
parent | b62243a5cc957ae0c7380bf8e020219e45366fe2 (diff) | |
download | rails-fe4abaa7df98aa736485b6ac863d05d80d2c1d89.tar.gz rails-fe4abaa7df98aa736485b6ac863d05d80d2c1d89.tar.bz2 rails-fe4abaa7df98aa736485b6ac863d05d80d2c1d89.zip |
Added Array#to_sentence that'll turn ['one', 'two', 'three'] into 'one, two, and three' #2157 [m.stienstra@fngtps.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2185 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 3b16c8d2b3..2ee86c8af9 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -12,3 +12,17 @@ class ArrayExtToParamTests < Test::Unit::TestCase assert_equal '10/20', [10, 20].to_param end end + +class ArrayExtConversionTests < Test::Unit::TestCase + def test_plain_array_to_sentence + 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('and also') + end + + def test_one_element + assert_equal "one", ['one'].to_sentence + end +end |