aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
authorGuillermo Álvarez <guillermo@cientifico.net>2009-02-07 19:16:15 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2009-02-22 16:11:40 +0100
commitff1afbd65098643a06eef928f92fecf6e9d548b2 (patch)
tree9cdef532d73a1f31383cb11df8fb95f3dc46243a /activesupport/test/core_ext
parentb61cad6ae140bc71c6a74b22c75e886b41154b0a (diff)
downloadrails-ff1afbd65098643a06eef928f92fecf6e9d548b2.tar.gz
rails-ff1afbd65098643a06eef928f92fecf6e9d548b2.tar.bz2
rails-ff1afbd65098643a06eef928f92fecf6e9d548b2.zip
Deprecated warnings for :skip_last_command and :connector of to_sentence [#1847 state:committed]
Signed-off-by: David Heinemeier Hansson <david@loudthinking.com>
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/array_ext_test.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb
index 367f0e0027..b70ec475ad 100644
--- a/activesupport/test/core_ext/array_ext_test.rb
+++ b/activesupport/test/core_ext/array_ext_test.rb
@@ -48,6 +48,8 @@ class ArrayExtToParamTests < Test::Unit::TestCase
end
class ArrayExtToSentenceTests < Test::Unit::TestCase
+ include ActiveSupport::Testing::Deprecation
+
def test_plain_array_to_sentence
assert_equal "", [].to_sentence
assert_equal "one", ['one'].to_sentence
@@ -56,12 +58,28 @@ class ArrayExtToSentenceTests < Test::Unit::TestCase
end
def test_to_sentence_with_words_connector
+ assert_deprecated(":connector has been deprecated. Use :words_connector instead") do
+ assert_equal "one, two, three", ['one', 'two', 'three'].to_sentence(:connector => '')
+ end
+
+ assert_deprecated(":connector has been deprecated. Use :words_connector instead") do
+ assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence(:connector => 'and ')
+ end
+
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_last_word_connector
+ assert_deprecated(":skip_last_comma has been deprecated. Use :last_word_connector instead") do
+ assert_equal "one, two and three", ['one', 'two', 'three'].to_sentence(:skip_last_comma => true)
+ end
+
+ assert_deprecated(":skip_last_comma has been deprecated. Use :last_word_connector instead") do
+ assert_equal "one, two, and three", ['one', 'two', 'three'].to_sentence(:skip_last_comma => false)
+ end
+
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 => ' ')