diff options
author | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:36:34 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-08-06 19:36:34 +0200 |
commit | 63fff600accb41b56a3e6ac403d9b1732de3086d (patch) | |
tree | eabc84f16214eade7d44386de14a23415a9c3e3d /actionview/test/template/number_helper_test.rb | |
parent | 5b6eb1d58b48fada298215b2cccda89f993890c3 (diff) | |
download | rails-63fff600accb41b56a3e6ac403d9b1732de3086d.tar.gz rails-63fff600accb41b56a3e6ac403d9b1732de3086d.tar.bz2 rails-63fff600accb41b56a3e6ac403d9b1732de3086d.zip |
modernizes hash syntax in actionview
Diffstat (limited to 'actionview/test/template/number_helper_test.rb')
-rw-r--r-- | actionview/test/template/number_helper_test.rb | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/actionview/test/template/number_helper_test.rb b/actionview/test/template/number_helper_test.rb index ed31b930dd..d55651bd4a 100644 --- a/actionview/test/template/number_helper_test.rb +++ b/actionview/test/template/number_helper_test.rb @@ -71,27 +71,27 @@ class NumberHelperTest < ActionView::TestCase def test_number_to_human_escape_units volume = { unit: "<b>ml</b>", thousand: "<b>lt</b>", million: "<b>m3</b>", trillion: "<b>km3</b>", quadrillion: "<b>Pl</b>" } - assert_equal "123 <b>lt</b>", number_to_human(123456, :units => volume) - assert_equal "12 <b>ml</b>", number_to_human(12, :units => volume) - assert_equal "1.23 <b>m3</b>", number_to_human(1234567, :units => volume) - assert_equal "1.23 <b>km3</b>", number_to_human(1_234_567_000_000, :units => volume) - assert_equal "1.23 <b>Pl</b>", number_to_human(1_234_567_000_000_000, :units => volume) + assert_equal "123 <b>lt</b>", number_to_human(123456, units: volume) + assert_equal "12 <b>ml</b>", number_to_human(12, units: volume) + assert_equal "1.23 <b>m3</b>", number_to_human(1234567, units: volume) + assert_equal "1.23 <b>km3</b>", number_to_human(1_234_567_000_000, units: volume) + assert_equal "1.23 <b>Pl</b>", number_to_human(1_234_567_000_000_000, units: volume) #Including fractionals distance = { mili: "<b>mm</b>", centi: "<b>cm</b>", deci: "<b>dm</b>", unit: "<b>m</b>", ten: "<b>dam</b>", hundred: "<b>hm</b>", thousand: "<b>km</b>", micro: "<b>um</b>", nano: "<b>nm</b>", pico: "<b>pm</b>", femto: "<b>fm</b>"} - assert_equal "1.23 <b>mm</b>", number_to_human(0.00123, :units => distance) - assert_equal "1.23 <b>cm</b>", number_to_human(0.0123, :units => distance) - assert_equal "1.23 <b>dm</b>", number_to_human(0.123, :units => distance) - assert_equal "1.23 <b>m</b>", number_to_human(1.23, :units => distance) - assert_equal "1.23 <b>dam</b>", number_to_human(12.3, :units => distance) - assert_equal "1.23 <b>hm</b>", number_to_human(123, :units => distance) - assert_equal "1.23 <b>km</b>", number_to_human(1230, :units => distance) - assert_equal "1.23 <b>um</b>", number_to_human(0.00000123, :units => distance) - assert_equal "1.23 <b>nm</b>", number_to_human(0.00000000123, :units => distance) - assert_equal "1.23 <b>pm</b>", number_to_human(0.00000000000123, :units => distance) - assert_equal "1.23 <b>fm</b>", number_to_human(0.00000000000000123, :units => distance) + assert_equal "1.23 <b>mm</b>", number_to_human(0.00123, units: distance) + assert_equal "1.23 <b>cm</b>", number_to_human(0.0123, units: distance) + assert_equal "1.23 <b>dm</b>", number_to_human(0.123, units: distance) + assert_equal "1.23 <b>m</b>", number_to_human(1.23, units: distance) + assert_equal "1.23 <b>dam</b>", number_to_human(12.3, units: distance) + assert_equal "1.23 <b>hm</b>", number_to_human(123, units: distance) + assert_equal "1.23 <b>km</b>", number_to_human(1230, units: distance) + assert_equal "1.23 <b>um</b>", number_to_human(0.00000123, units: distance) + assert_equal "1.23 <b>nm</b>", number_to_human(0.00000000123, units: distance) + assert_equal "1.23 <b>pm</b>", number_to_human(0.00000000000123, units: distance) + assert_equal "1.23 <b>fm</b>", number_to_human(0.00000000000000123, units: distance) end def test_number_helpers_escape_delimiter_and_separator @@ -117,8 +117,8 @@ class NumberHelperTest < ActionView::TestCase def test_number_to_human_with_custom_translation_scope I18n.backend.store_translations "ts", - :custom_units_for_number_to_human => {:mili => "mm", :centi => "cm", :deci => "dm", :unit => "m", :ten => "dam", :hundred => "hm", :thousand => "km"} - assert_equal "1.01 cm", number_to_human(0.0101, :locale => "ts", :units => :custom_units_for_number_to_human) + custom_units_for_number_to_human: {mili: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km"} + assert_equal "1.01 cm", number_to_human(0.0101, locale: "ts", units: :custom_units_for_number_to_human) ensure I18n.reload! end |