class IntegerExtTest
Constants
- PRIME
Public Instance Methods
test_multiple_of()
click to toggle source
# File activesupport/test/core_ext/integer_ext_test.rb, line 9 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) } # test the 0 edge case assert 0.multiple_of?(0) assert !5.multiple_of?(0) # test with a prime [2, 3, 5, 7].each { |i| assert !PRIME.multiple_of?(i) } end
test_ordinal()
click to toggle source
# File activesupport/test/core_ext/integer_ext_test.rb, line 28 def test_ordinal assert_equal "st", 1.ordinal assert_equal "th", 8.ordinal end
test_ordinalize()
click to toggle source
# File activesupport/test/core_ext/integer_ext_test.rb, line 21 def test_ordinalize # These tests are mostly just to ensure that the ordinalize method exists. # Its results are tested comprehensively in the inflector test cases. assert_equal "1st", 1.ordinalize assert_equal "8th", 8.ordinalize end