summaryrefslogtreecommitdiff
path: root/spec/ruby/core/range/minmax_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/range/minmax_spec.rb')
-rw-r--r--spec/ruby/core/range/minmax_spec.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/spec/ruby/core/range/minmax_spec.rb b/spec/ruby/core/range/minmax_spec.rb
index fa0637ac56..1db9bfce38 100644
--- a/spec/ruby/core/range/minmax_spec.rb
+++ b/spec/ruby/core/range/minmax_spec.rb
@@ -1,6 +1,6 @@
require_relative '../../spec_helper'
-# These specs use Range.new instead of the literal notation so they parse fine on Ruby < 2.6
+# These specs use Range.new instead of the literal notation for beginless Ranges so they parse fine on Ruby < 2.7
describe 'Range#minmax' do
before(:each) do
@x = mock('x')
@@ -13,10 +13,10 @@ describe 'Range#minmax' do
end
describe 'on an inclusive range' do
- ruby_version_is '2.6'...'2.7' do
+ ruby_version_is ''...'2.7' do
it 'should try to iterate endlessly on an endless range' do
@x.should_receive(:succ).once.and_return(@y)
- range = Range.new(@x, nil)
+ range = (@x..)
-> { range.minmax }.should raise_error(NoMethodError, /^undefined method `succ' for/)
end
@@ -26,7 +26,7 @@ describe 'Range#minmax' do
it 'should raise RangeError on an endless range without iterating the range' do
@x.should_not_receive(:succ)
- range = Range.new(@x, nil)
+ range = (@x..)
-> { range.minmax }.should raise_error(RangeError, 'cannot get the maximum of endless range')
end
@@ -96,11 +96,11 @@ describe 'Range#minmax' do
end
describe 'on an exclusive range' do
- ruby_version_is '2.6'...'2.7' do
+ ruby_version_is ''...'2.7' do
# Endless ranges introduced in 2.6
it 'should try to iterate endlessly on an endless range' do
@x.should_receive(:succ).once.and_return(@y)
- range = Range.new(@x, nil, true)
+ range = (@x...)
-> { range.minmax }.should raise_error(NoMethodError, /^undefined method `succ' for/)
end
@@ -109,7 +109,7 @@ describe 'Range#minmax' do
ruby_version_is '2.7' do
it 'should raise RangeError on an endless range' do
@x.should_not_receive(:succ)
- range = Range.new(@x, nil, true)
+ range = (@x...)
-> { range.minmax }.should raise_error(RangeError, 'cannot get the maximum of endless range')
end