aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2007-12-02 00:28:30 +0000
committerMichael Koziarski <michael@koziarski.com>2007-12-02 00:28:30 +0000
commit67442cb40d0850f42ff66a66e2c2b3f5cf5feb07 (patch)
treea256ff8cd19105da9b86659c1c71cb4b90b5d574 /activesupport/test
parentc01c28c3047bbf0be2861c7ae1146723cf4ff7a9 (diff)
downloadrails-67442cb40d0850f42ff66a66e2c2b3f5cf5feb07.tar.gz
rails-67442cb40d0850f42ff66a66e2c2b3f5cf5feb07.tar.bz2
rails-67442cb40d0850f42ff66a66e2c2b3f5cf5feb07.zip
Fix potential extra space in Array#to_sentence. Closes #10327 [kamal]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8251 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activesupport/test')
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb
index ade2e95c1b..5831e2a56a 100644
--- a/activesupport/test/core_ext/array_ext_test.rb
+++ b/activesupport/test/core_ext/array_ext_test.rb
@@ -38,6 +38,10 @@ class ArrayExtToSentenceTests < Test::Unit::TestCase
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 ')
end
def test_to_sentence_with_skip_last_comma
@@ -46,11 +50,13 @@ class ArrayExtToSentenceTests < Test::Unit::TestCase
def test_two_elements
assert_equal "one and two", ['one', 'two'].to_sentence
+ assert_equal "one two", ['one', 'two'].to_sentence(:connector => '')
end
def test_one_element
assert_equal "one", ['one'].to_sentence
end
+
end
class ArrayExtToSTests < Test::Unit::TestCase