diff options
author | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 23:32:09 +0100 |
---|---|---|
committer | José Valim and Mikel Lindsaar <pair@programming.com> | 2010-01-24 23:32:09 +0100 |
commit | 328b0b1268596347975349c6df5ce713ad377bd4 (patch) | |
tree | 7ad2ee46d3a29e0e725ef084e06dc832e6324f94 /activesupport | |
parent | 0361414ae328c10de8ed778e826d8244ba0aa63a (diff) | |
download | rails-328b0b1268596347975349c6df5ce713ad377bd4.tar.gz rails-328b0b1268596347975349c6df5ce713ad377bd4.tar.bz2 rails-328b0b1268596347975349c6df5ce713ad377bd4.zip |
Remove deprecated behavior since 2.3.
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/core_ext/array/conversions.rb | 13 | ||||
-rw-r--r-- | activesupport/test/core_ext/array_ext_test.rb | 18 |
2 files changed, 1 insertions, 30 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb index 7fcef38372..814567a5a6 100644 --- a/activesupport/lib/active_support/core_ext/array/conversions.rb +++ b/activesupport/lib/active_support/core_ext/array/conversions.rb @@ -13,19 +13,6 @@ class Array default_two_words_connector = I18n.translate(:'support.array.two_words_connector', :locale => options[:locale]) default_last_word_connector = I18n.translate(:'support.array.last_word_connector', :locale => options[:locale]) - # Try to emulate to_sentences previous to 2.3 - if options.has_key?(:connector) || options.has_key?(:skip_last_comma) - ::ActiveSupport::Deprecation.warn(":connector has been deprecated. Use :words_connector instead", caller) if options.has_key? :connector - ::ActiveSupport::Deprecation.warn(":skip_last_comma has been deprecated. Use :last_word_connector instead", caller) if options.has_key? :skip_last_comma - - skip_last_comma = options.delete :skip_last_comma - if connector = options.delete(:connector) - options[:last_word_connector] ||= skip_last_comma ? connector : ", #{connector}" - else - options[:last_word_connector] ||= skip_last_comma ? default_two_words_connector : default_last_word_connector - end - end - options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale) options.reverse_merge! :words_connector => default_words_connector, :two_words_connector => default_two_words_connector, :last_word_connector => default_last_word_connector diff --git a/activesupport/test/core_ext/array_ext_test.rb b/activesupport/test/core_ext/array_ext_test.rb index 6f3b28682a..d4cd5ddbde 100644 --- a/activesupport/test/core_ext/array_ext_test.rb +++ b/activesupport/test/core_ext/array_ext_test.rb @@ -51,7 +51,7 @@ class ArrayExtToParamTests < Test::Unit::TestCase end end -class ArrayExtToSentenceTests < ActiveSupport::TestCase +class ArrayExtToSentenceTests < Test::Unit::TestCase def test_plain_array_to_sentence assert_equal "", [].to_sentence assert_equal "one", ['one'].to_sentence @@ -60,28 +60,12 @@ class ArrayExtToSentenceTests < ActiveSupport::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 => ' ') |