aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/numeric_ext_test.rb
diff options
context:
space:
mode:
authorVipul A M <vipulnsward@gmail.com>2013-03-17 16:21:33 +0530
committerVipul A M <vipulnsward@gmail.com>2013-03-17 16:21:33 +0530
commitb9f7e634adb2f5d6c22a0c1cd0d06e42f0d73cf0 (patch)
tree375ad5eb68db4fbc73d1b03cf09cc3108f268d06 /activesupport/test/core_ext/numeric_ext_test.rb
parentf5ecb133335dbfcb2322e5ce91158cf91f730aea (diff)
downloadrails-b9f7e634adb2f5d6c22a0c1cd0d06e42f0d73cf0.tar.gz
rails-b9f7e634adb2f5d6c22a0c1cd0d06e42f0d73cf0.tar.bz2
rails-b9f7e634adb2f5d6c22a0c1cd0d06e42f0d73cf0.zip
refactor test to drop unnecessary hash creation, test directly instead
Diffstat (limited to 'activesupport/test/core_ext/numeric_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/numeric_ext_test.rb26
1 files changed, 10 insertions, 16 deletions
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
index 8c7d00cae1..3744d50864 100644
--- a/activesupport/test/core_ext/numeric_ext_test.rb
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
@@ -153,22 +153,16 @@ end
class NumericExtSizeTest < ActiveSupport::TestCase
def test_unit_in_terms_of_another
- relationships = {
- 1024.bytes => 1.kilobyte,
- 1024.kilobytes => 1.megabyte,
- 3584.0.kilobytes => 3.5.megabytes,
- 3584.0.megabytes => 3.5.gigabytes,
- 1.kilobyte ** 4 => 1.terabyte,
- 1024.kilobytes + 2.megabytes => 3.megabytes,
- 2.gigabytes / 4 => 512.megabytes,
- 256.megabytes * 20 + 5.gigabytes => 10.gigabytes,
- 1.kilobyte ** 5 => 1.petabyte,
- 1.kilobyte ** 6 => 1.exabyte
- }
-
- relationships.each do |left, right|
- assert_equal right, left
- end
+ assert_equal 1024.bytes, 1.kilobyte
+ assert_equal 1024.kilobytes, 1.megabyte
+ assert_equal 3584.0.kilobytes, 3.5.megabytes
+ assert_equal 3584.0.megabytes, 3.5.gigabytes
+ assert_equal 1.kilobyte ** 4, 1.terabyte
+ assert_equal 1024.kilobytes + 2.megabytes, 3.megabytes
+ assert_equal 2.gigabytes / 4, 512.megabytes
+ assert_equal 256.megabytes * 20 + 5.gigabytes, 10.gigabytes
+ assert_equal 1.kilobyte ** 5, 1.petabyte
+ assert_equal 1.kilobyte ** 6, 1.exabyte
end
def test_units_as_bytes_independently