diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-03-17 07:17:28 -0700 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2013-03-17 07:17:28 -0700 |
commit | 226d16985b10bd67bc44094d345f35e2f81b2182 (patch) | |
tree | 375ad5eb68db4fbc73d1b03cf09cc3108f268d06 | |
parent | f5ecb133335dbfcb2322e5ce91158cf91f730aea (diff) | |
parent | b9f7e634adb2f5d6c22a0c1cd0d06e42f0d73cf0 (diff) | |
download | rails-226d16985b10bd67bc44094d345f35e2f81b2182.tar.gz rails-226d16985b10bd67bc44094d345f35e2f81b2182.tar.bz2 rails-226d16985b10bd67bc44094d345f35e2f81b2182.zip |
Merge pull request #9759 from vipulnsward/remove_hash_from_tests
refactor test to drop unnecessary hash creation, test directly instead
-rw-r--r-- | activesupport/test/core_ext/numeric_ext_test.rb | 26 |
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 |