diff options
author | Andrew White <andrew.white@unboxed.co> | 2016-11-13 23:08:13 +0000 |
---|---|---|
committer | Andrew White <andrew.white@unboxed.co> | 2016-11-13 23:09:03 +0000 |
commit | dadba9ae5711c36e0491dffbd8fd03b96db45c19 (patch) | |
tree | 824395311681c243fd48ecf9b5c93aa21fb7ddc3 /activesupport | |
parent | 2ff2b98032409d162cd2a0ffc1b21c63057f628d (diff) | |
download | rails-dadba9ae5711c36e0491dffbd8fd03b96db45c19.tar.gz rails-dadba9ae5711c36e0491dffbd8fd03b96db45c19.tar.bz2 rails-dadba9ae5711c36e0491dffbd8fd03b96db45c19.zip |
Remove deprecated :prefix option
Diffstat (limited to 'activesupport')
3 files changed, 1 insertions, 37 deletions
diff --git a/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb b/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb index 02b4231794..f263dbe9f8 100644 --- a/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb +++ b/activesupport/lib/active_support/number_helper/number_to_human_size_converter.rb @@ -7,10 +7,6 @@ module ActiveSupport self.validate_float = true def convert - if opts.key?(:prefix) - ActiveSupport::Deprecation.warn("The :prefix option of `number_to_human_size` is deprecated and will be removed in Rails 5.1 with no replacement.") - end - @number = Float(number) # for backwards compatibility with those that didn't add strip_insignificant_zeros to their locale files @@ -54,7 +50,7 @@ module ActiveSupport end def base - opts[:prefix] == :si ? 1000 : 1024 + 1024 end end end diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb index dfc9bc24c7..a6e5ea5ab7 100644 --- a/activesupport/test/core_ext/numeric_ext_test.rb +++ b/activesupport/test/core_ext/numeric_ext_test.rb @@ -287,21 +287,6 @@ class NumericExtFormattingTest < ActiveSupport::TestCase assert_equal "10 Bytes", 10.to_s(:human_size) end - def test_to_s__human_size_with_si_prefix - assert_deprecated do - assert_equal "3 Bytes", 3.14159265.to_s(:human_size, prefix: :si) - assert_equal "123 Bytes", 123.0.to_s(:human_size, prefix: :si) - assert_equal "123 Bytes", 123.to_s(:human_size, prefix: :si) - assert_equal "1.23 KB", 1234.to_s(:human_size, prefix: :si) - assert_equal "12.3 KB", 12345.to_s(:human_size, prefix: :si) - assert_equal "1.23 MB", 1234567.to_s(:human_size, prefix: :si) - assert_equal "1.23 GB", 1234567890.to_s(:human_size, prefix: :si) - assert_equal "1.23 TB", 1234567890123.to_s(:human_size, prefix: :si) - assert_equal "1.23 PB", 1234567890123456.to_s(:human_size, prefix: :si) - assert_equal "1.23 EB", 1234567890123456789.to_s(:human_size, prefix: :si) - end - end - def test_to_s__human_size_with_options_hash assert_equal "1.2 MB", 1234567.to_s(:human_size, precision: 2) assert_equal "3 Bytes", 3.14159265.to_s(:human_size, precision: 4) diff --git a/activesupport/test/number_helper_test.rb b/activesupport/test/number_helper_test.rb index 8f6eb91e71..dc0c34d4e2 100644 --- a/activesupport/test/number_helper_test.rb +++ b/activesupport/test/number_helper_test.rb @@ -244,23 +244,6 @@ module ActiveSupport end end - def test_number_to_human_size_with_si_prefix - assert_deprecated do - [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper| - assert_equal "3 Bytes", number_helper.number_to_human_size(3.14159265, prefix: :si) - assert_equal "123 Bytes", number_helper.number_to_human_size(123.0, prefix: :si) - assert_equal "123 Bytes", number_helper.number_to_human_size(123, prefix: :si) - assert_equal "1.23 KB", number_helper.number_to_human_size(1234, prefix: :si) - assert_equal "12.3 KB", number_helper.number_to_human_size(12345, prefix: :si) - assert_equal "1.23 MB", number_helper.number_to_human_size(1234567, prefix: :si) - assert_equal "1.23 GB", number_helper.number_to_human_size(1234567890, prefix: :si) - assert_equal "1.23 TB", number_helper.number_to_human_size(1234567890123, prefix: :si) - assert_equal "1.23 PB", number_helper.number_to_human_size(1234567890123456, prefix: :si) - assert_equal "1.23 EB", number_helper.number_to_human_size(1234567890123456789, prefix: :si) - end - end - end - def test_number_to_human_size_with_options_hash [@instance_with_helpers, TestClassWithClassNumberHelpers, ActiveSupport::NumberHelper].each do |number_helper| assert_equal "1.2 MB", number_helper.number_to_human_size(1234567, precision: 2) |