Skip to content

Commit c6339d8

Browse files
committed
Make the Range#minmax specs pass on 2.6, 2.7 and ruby-head
1 parent a79f622 commit c6339d8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/range/minmax_spec.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,18 @@
3333

3434
-> { range.minmax }.should raise_error(RangeError, 'cannot get the maximum of endless range')
3535
end
36+
end
3637

37-
# Beginless ranges introduced in 2.7
38+
ruby_version_is '2.7'...'3.0' do
39+
it 'raises ArgumentError on a beginless range' do
40+
# Beginless range literal would cause SyntaxError prior to 2.7
41+
range = Range.new(nil, @x)
42+
43+
-> { range.minmax }.should raise_error(ArgumentError)
44+
end
45+
end
46+
47+
ruby_version_is '3.0' do
3848
it 'should raise RangeError on a beginless range' do
3949
# Beginless range literal would cause SyntaxError prior to 2.7
4050
range = Range.new(nil, @x)
@@ -120,7 +130,8 @@
120130
# Beginless range literal would cause SyntaxError prior to 2.7
121131
range = Range.new(nil, @x, true)
122132

123-
-> { range.minmax }.should raise_error(RangeError, 'cannot get the minimum of beginless range')
133+
-> { range.minmax }.should raise_error(RangeError,
134+
/cannot get the maximum of beginless range with custom comparison method|cannot get the minimum of beginless range/)
124135
end
125136
end
126137

0 commit comments

Comments
 (0)