aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/range_ext_test.rb
diff options
context:
space:
mode:
authorDiego Carrion <dc.rec1@gmail.com>2011-02-19 21:13:07 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-19 23:24:30 -0200
commitb0da0dd8345b68a4e54c52e398cc65bbc0c4fbb5 (patch)
treeafa3ac149ebd946cf4ecff1571fcf078247075ac /activesupport/test/core_ext/range_ext_test.rb
parent289cc15f1a89a179116f67e5f666f4ff6d645f03 (diff)
downloadrails-b0da0dd8345b68a4e54c52e398cc65bbc0c4fbb5.tar.gz
rails-b0da0dd8345b68a4e54c52e398cc65bbc0c4fbb5.tar.bz2
rails-b0da0dd8345b68a4e54c52e398cc65bbc0c4fbb5.zip
added Range#count? for Ruby 1.8
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activesupport/test/core_ext/range_ext_test.rb')
-rw-r--r--activesupport/test/core_ext/range_ext_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/range_ext_test.rb b/activesupport/test/core_ext/range_ext_test.rb
index 5701eeef28..1424fa4aca 100644
--- a/activesupport/test/core_ext/range_ext_test.rb
+++ b/activesupport/test/core_ext/range_ext_test.rb
@@ -62,4 +62,16 @@ class RangeTest < Test::Unit::TestCase
(1..10).step(2) {|i| array << i }
assert_equal [1,3,5,7,9], array
end
+
+ if RUBY_VERSION < '1.9'
+ def test_cover
+ assert((1..3).cover?(2))
+ assert !(1..3).cover?(4)
+ end
+ else
+ def test_cover_is_not_override
+ range = (1..3)
+ assert range.method(:include?) != range.method(:cover?)
+ end
+ end
end