File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ RSpec/ImplicitSubject:
35
35
RSpec/MultipleExpectations :
36
36
Max : 5
37
37
38
+ RSpec/MultipleMemoizedHelpers :
39
+ Max : 10
40
+
38
41
# %i[foo bar baz] is more difficult to understand than [:foo, :bar, :baz]
39
42
Style/SymbolArray :
40
43
Enabled : false
Original file line number Diff line number Diff line change 8
8
end
9
9
let ( :range ) { described_class . new ( first , last ) . by ( **by ) }
10
10
11
+ # Range#size is supposed to always return nil when the range
12
+ # isn't numeric, but some versions of Ruby have a bug.
13
+ let ( :range_size_return ) { nil }
14
+
11
15
shared_examples 'it is infinite' do
12
16
describe '#count' do
13
17
subject { range . count }
80
84
describe '#size' do
81
85
subject { range . size }
82
86
83
- it { is_expected . to be_nil }
87
+ it { is_expected . to eq range_size_return }
84
88
end
85
89
end
86
90
182
186
183
187
context 'with no begin' do
184
188
let ( :first ) { nil }
189
+ # Ruby 3.1 has a bug where #size returns Infinity for
190
+ # beginless non-Numeric ranges.
191
+ let ( :range_size_return ) { ( .."z" ) . size }
185
192
186
193
it_behaves_like 'a Range'
187
194
it_behaves_like 'it has an end'
You can’t perform that action at this time.
0 commit comments