From 4b6c68dfb810c836f87587a16353317d1a180805 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Sat, 6 Aug 2016 18:50:17 +0200 Subject: applies new string literal convention in actionview/test The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default. --- actionview/test/template/number_helper_test.rb | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'actionview/test/template/number_helper_test.rb') diff --git a/actionview/test/template/number_helper_test.rb b/actionview/test/template/number_helper_test.rb index ace3e950b8..ed31b930dd 100644 --- a/actionview/test/template/number_helper_test.rb +++ b/actionview/test/template/number_helper_test.rb @@ -20,16 +20,16 @@ class NumberHelperTest < ActionView::TestCase assert_equal "&pound;1,234,567,890.50", number_to_currency("1234567890.50", unit: "£") assert_equal "<b>1,234,567,890.50</b> $", number_to_currency("1234567890.50", format: "%n %u") assert_equal "<b>1,234,567,890.50</b> $", number_to_currency("-1234567890.50", negative_format: "%n %u") - assert_equal "<b>1,234,567,890.50</b> $", number_to_currency("-1234567890.50", 'negative_format' => "%n %u") - assert_equal '₹ 12,30,000.00', number_to_currency(1230000, delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/, unit: '₹', format: "%u %n") + assert_equal "<b>1,234,567,890.50</b> $", number_to_currency("-1234567890.50", "negative_format" => "%n %u") + assert_equal "₹ 12,30,000.00", number_to_currency(1230000, delimiter_pattern: /(\d+?)(?=(\d\d)+(\d)(?!\d))/, unit: "₹", format: "%u %n") end def test_number_to_percentage assert_equal nil, number_to_percentage(nil) assert_equal "100.000%", number_to_percentage(100) - assert_equal "100.000 %", number_to_percentage(100, format: '%n %') - assert_equal "<b>100.000</b> %", number_to_percentage(100, format: '%n %') - assert_equal "100.000 %", number_to_percentage(100, format: raw('%n %')) + assert_equal "100.000 %", number_to_percentage(100, format: "%n %") + assert_equal "<b>100.000</b> %", number_to_percentage(100, format: "%n %") + assert_equal "100.000 %", number_to_percentage(100, format: raw("%n %")) assert_equal "100%", number_to_percentage(100, precision: 0) assert_equal "123.4%", number_to_percentage(123.400, precision: 3, strip_insignificant_zeros: true) assert_equal "1.000,000%", number_to_percentage(1000, delimiter: ".", separator: ",") @@ -71,27 +71,27 @@ class NumberHelperTest < ActionView::TestCase def test_number_to_human_escape_units volume = { unit: "ml", thousand: "lt", million: "m3", trillion: "km3", quadrillion: "Pl" } - 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: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km", micro: "um", nano: "nm", pico: "pm", femto: "fm"} - 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 @@ -116,9 +116,9 @@ class NumberHelperTest < ActionView::TestCase end def test_number_to_human_with_custom_translation_scope - I18n.backend.store_translations 'ts', + 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) + assert_equal "1.01 cm", number_to_human(0.0101, :locale => "ts", :units => :custom_units_for_number_to_human) ensure I18n.reload! end -- cgit v1.2.3