File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 12
12
# isn't numeric, but some versions of Ruby have a bug.
13
13
let ( :range_size_return ) { nil }
14
14
15
+ # Range#max can have a bug where it sometimes errors.
16
+ let ( :has_range_max_bug ) { false }
17
+
15
18
shared_examples 'it is infinite' do
16
19
describe '#count' do
17
20
subject { range . count }
180
183
describe '#max' do
181
184
subject { range . max }
182
185
183
- it { is_expected . to eq last }
186
+ it 'has a max' do
187
+ skip "Range#max has a bug" if has_range_max_bug
188
+ expect ( range . max ) . to eq last
189
+ end
184
190
end
185
191
end
186
192
190
196
# beginless non-Numeric ranges.
191
197
let ( :range_size_return ) { ( .."z" ) . size }
192
198
199
+ # Ruby 2.7 has a bug where #max will raise
200
+ # ArgumentError (comparison of NilClass with String failed)
201
+ let ( :has_range_max_bug ) do
202
+ ( .."z" ) . max
203
+ false
204
+ rescue ArgumentError
205
+ true
206
+ end
207
+
193
208
it_behaves_like 'a Range'
194
209
it_behaves_like 'it has an end'
195
210
it_behaves_like 'it is infinite'
You can’t perform that action at this time.
0 commit comments