mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Deprecate :si prefix in number_to_human_size without replacement
This commit is contained in:
parent
7081106457
commit
e96403bd5c
2 changed files with 15 additions and 9 deletions
|
@ -1,3 +1,7 @@
|
|||
* Deprecate `:prefix` option of `number_to_human_size` with no replacement.
|
||||
|
||||
*Jean Boussier*
|
||||
|
||||
* Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:
|
||||
twz = DateTime.now.in_time_zone
|
||||
twz.eql?(twz.dup) => true
|
||||
|
|
|
@ -234,15 +234,17 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def test_number_to_human_size_with_si_prefix
|
||||
[@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_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)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue