aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/numeric_ext_test.rb
diff options
context:
space:
mode:
authorMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-05-13 21:03:51 +0300
committerMehmet Emin İNAÇ <mehmetemininac@gmail.com>2015-05-13 21:03:51 +0300
commited83f90d6124c4185a6d31010770e3c84d6be5fc (patch)
treeb8096f9d1d00e053426f75f0fda92c50c43f5ee3 /activesupport/test/core_ext/numeric_ext_test.rb
parent94025927d79cbdbaf3b6e41fb2112d086f21dea3 (diff)
downloadrails-ed83f90d6124c4185a6d31010770e3c84d6be5fc.tar.gz
rails-ed83f90d6124c4185a6d31010770e3c84d6be5fc.tar.bz2
rails-ed83f90d6124c4185a6d31010770e3c84d6be5fc.zip
Move Integer#positive? and Integer#negative? query methods to Numeric class
By this way Integer, Rational, Float, Fixnum, Bignum classes have the same behaviour
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, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/numeric_ext_test.rb b/activesupport/test/core_ext/numeric_ext_test.rb
index b82448458d..192b2ba577 100644
--- a/activesupport/test/core_ext/numeric_ext_test.rb
+++ b/activesupport/test/core_ext/numeric_ext_test.rb
@@ -389,4 +389,16 @@ class NumericExtFormattingTest < ActiveSupport::TestCase
def test_in_milliseconds
assert_equal 10_000, 10.seconds.in_milliseconds
end
+
+ def test_positive
+ assert 1.positive?
+ assert_not 0.positive?
+ assert_not -1.positive?
+ end
+
+ def test_negative
+ assert -1.negative?
+ assert_not 0.negative?
+ assert_not 1.negative?
+ end
end