aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/numeric_ext_test.rb
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-16 04:30:11 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2016-08-16 04:30:11 -0300
commit55f9b8129a50206513264824abb44088230793c2 (patch)
treeff2f01cabfc7e74b0bd831c2272a5517e4e81e99 /activesupport/test/core_ext/numeric_ext_test.rb
parentd0bdd74d7f6fae3d69b3681d5bc2d5ef6f55a0f8 (diff)
downloadrails-55f9b8129a50206513264824abb44088230793c2.tar.gz
rails-55f9b8129a50206513264824abb44088230793c2.tar.bz2
rails-55f9b8129a50206513264824abb44088230793c2.zip
Add three new rubocop rules
Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
Diffstat (limited to 'activesupport/test/core_ext/numeric_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/numeric_ext_test.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
index b99217a1b3..5e824747ed 100644
--- a/activesupport/test/core_ext/numeric_ext_test.rb
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
@@ -348,13 +348,13 @@ class NumericExtFormattingTest < ActiveSupport::TestCase
def test_number_to_human_with_custom_units
#Only integers
- volume = {unit: "ml", thousand: "lt", million: "m3"}
+ volume = { unit: "ml", thousand: "lt", million: "m3" }
assert_equal "123 lt", 123456.to_s(:human, units: volume)
assert_equal "12 ml", 12.to_s(:human, units: volume)
assert_equal "1.23 m3", 1234567.to_s(:human, units: volume)
#Including fractionals
- distance = {mili: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km"}
+ distance = { mili: "mm", centi: "cm", deci: "dm", unit: "m", ten: "dam", hundred: "hm", thousand: "km" }
assert_equal "1.23 mm", 0.00123.to_s(:human, units: distance)
assert_equal "1.23 cm", 0.0123.to_s(:human, units: distance)
assert_equal "1.23 dm", 0.123.to_s(:human, units: distance)
@@ -367,20 +367,20 @@ class NumericExtFormattingTest < ActiveSupport::TestCase
assert_equal "12.3 km", 12300.to_s(:human, units: distance)
#The quantifiers don't need to be a continuous sequence
- gangster = {hundred: "hundred bucks", million: "thousand quids"}
+ gangster = { hundred: "hundred bucks", million: "thousand quids" }
assert_equal "1 hundred bucks", 100.to_s(:human, units: gangster)
assert_equal "25 hundred bucks", 2500.to_s(:human, units: gangster)
assert_equal "25 thousand quids", 25000000.to_s(:human, units: gangster)
assert_equal "12300 thousand quids", 12345000000.to_s(:human, units: gangster)
#Spaces are stripped from the resulting string
- assert_equal "4", 4.to_s(:human, units: {unit: "", ten: "tens "})
- assert_equal "4.5 tens", 45.to_s(:human, units: {unit: "", ten: " tens "})
+ assert_equal "4", 4.to_s(:human, units: { unit: "", ten: "tens " })
+ assert_equal "4.5 tens", 45.to_s(:human, units: { unit: "", ten: " tens " })
end
def test_number_to_human_with_custom_format
assert_equal "123 times Thousand", 123456.to_s(:human, format: "%n times %u")
- volume = {unit: "ml", thousand: "lt", million: "m3"}
+ volume = { unit: "ml", thousand: "lt", million: "m3" }
assert_equal "123.lt", 123456.to_s(:human, units: volume, format: "%n.%u")
end