Skip to content

Fix #expect_query test helper for Ruby 3.3+ #5981

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

johnnyshields
Copy link
Contributor

@johnnyshields johnnyshields commented May 9, 2025

The #expect_query test helper is basically broken on Ruby 3.3+. I'm not sure how CI tests are even passing with it in its current form... probably Mongoid is not running Ruby 3.3 / Ruby 3.4 tests properly.

I encountered this while testing older Mongoid versions--7.5, 8.0, etc.--on Ruby 3.3/3.4. Several tests which call this helper deterministically fail. To reproduce, you can check out this commit, then run the tests for Mongoid::Association::Referenced::BelongsTo::Eager.

It appears the reason it broke it due to Ruby 3.3's "Object Shapes" changes which affected how method interception used by RSpec's .and_call_original works, creating an infinite loop of interception.

@johnnyshields johnnyshields requested a review from a team as a code owner May 9, 2025 20:02
@johnnyshields johnnyshields requested a review from jamis May 9, 2025 20:02
@johnnyshields johnnyshields changed the title Remove reference to ancient driver in tests Fix #expect_query test helper for Ruby 3.3+ May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant