Skip to content

Commit 03b03c7

Browse files
slhckclaude
andcommitted
Fix Ruby 3.2/3.3 compatibility in Fixnum test
Replace Fixnum with Integer in spec/rails_spec.rb to fix test failures on Ruby 3.2 and 3.3. Background: - Fixnum and Bignum were unified into Integer in Ruby 2.4 - The test was monkey-patching Fixnum, which behaves differently in Ruby 3.2+ - This caused the "default per page in model" test to fail for Kaminari and WillPaginate on Ruby 3.2/3.3 Changes: - Replace all instances of `class Fixnum` with `class Integer` - Add comment explaining the Ruby 2.4+ change - All tests now pass on Ruby 3.1, 3.2, and 3.3 Testing: - Ruby 3.2.7: All Kaminari and WillPaginate tests pass - Ruby 3.3.8: All Kaminari and WillPaginate tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6384719 commit 03b03c7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spec/rails_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,8 @@
245245
if [:will_paginate, :kaminari].include?(ApiPagination.config.paginator.to_sym)
246246
context 'default per page in model' do
247247
before do
248-
class Fixnum
248+
# Use Integer instead of Fixnum (Fixnum was unified with Integer in Ruby 2.4+)
249+
class Integer
249250
@default_per_page = 6
250251
@per_page = 6
251252

@@ -256,14 +257,14 @@ class << self
256257
end
257258

258259
after do
259-
class Fixnum
260+
class Integer
260261
@default_per_page = 25
261262
@per_page = 25
262263
end
263264
end
264265

265266
after :all do
266-
class Fixnum
267+
class Integer
267268
class << self
268269
undef_method :default_per_page, :per_page
269270
end
@@ -277,7 +278,7 @@ class << self
277278
end
278279

279280
it 'should not fail if the model yields nil for per page' do
280-
class Fixnum
281+
class Integer
281282
@default_per_page = nil
282283
@per_page = nil
283284
end

0 commit comments

Comments
 (0)