From 83bf0b626cf2134260903e57d74f67de57384073 Mon Sep 17 00:00:00 2001 From: Vijay Dev Date: Wed, 16 Nov 2011 02:36:36 +0530 Subject: refactor test_multiple_of --- activesupport/test/core_ext/integer_ext_test.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'activesupport/test/core_ext') diff --git a/activesupport/test/core_ext/integer_ext_test.rb b/activesupport/test/core_ext/integer_ext_test.rb index fe8c7eb224..b1f5f70a70 100644 --- a/activesupport/test/core_ext/integer_ext_test.rb +++ b/activesupport/test/core_ext/integer_ext_test.rb @@ -2,6 +2,8 @@ require 'abstract_unit' require 'active_support/core_ext/integer' class IntegerExtTest < Test::Unit::TestCase + PRIME = 22953686867719691230002707821868552601124472329079 + def test_multiple_of [ -7, 0, 7, 14 ].each { |i| assert i.multiple_of?(7) } [ -7, 7, 14 ].each { |i| assert ! i.multiple_of?(6) } @@ -11,10 +13,7 @@ class IntegerExtTest < Test::Unit::TestCase assert !5.multiple_of?(0) # test with a prime - assert !22953686867719691230002707821868552601124472329079.multiple_of?(2) - assert !22953686867719691230002707821868552601124472329079.multiple_of?(3) - assert !22953686867719691230002707821868552601124472329079.multiple_of?(5) - assert !22953686867719691230002707821868552601124472329079.multiple_of?(7) + [2, 3, 5, 7].each { |i| assert !PRIME.multiple_of?(i) } end def test_ordinalize -- cgit v1.2.3