From 03b03c7b8e650719084e025b37fb54ae7a8d6832 Mon Sep 17 00:00:00 2001 From: Werner Robitza Date: Sat, 8 Nov 2025 08:25:08 +0100 Subject: [PATCH] Fix Ruby 3.2/3.3 compatibility in Fixnum test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- spec/rails_spec.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/rails_spec.rb b/spec/rails_spec.rb index f23ef96..556a1bb 100644 --- a/spec/rails_spec.rb +++ b/spec/rails_spec.rb @@ -245,7 +245,8 @@ if [:will_paginate, :kaminari].include?(ApiPagination.config.paginator.to_sym) context 'default per page in model' do before do - class Fixnum + # Use Integer instead of Fixnum (Fixnum was unified with Integer in Ruby 2.4+) + class Integer @default_per_page = 6 @per_page = 6 @@ -256,14 +257,14 @@ class << self end after do - class Fixnum + class Integer @default_per_page = 25 @per_page = 25 end end after :all do - class Fixnum + class Integer class << self undef_method :default_per_page, :per_page end @@ -277,7 +278,7 @@ class << self end it 'should not fail if the model yields nil for per page' do - class Fixnum + class Integer @default_per_page = nil @per_page = nil end