-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update to Rails 7 #2324
Update to Rails 7 #2324
Conversation
ba0819b
to
ccdc161
Compare
@nickcharlton - Not sure what to do about this. I'm considering skipping the offending example under Ruby 3.x. Thoughts? |
Hmm, interesting. On |
The specs do pass individually. The problem is running them all together, particularly when
|
Oh, right I see! Yeah, I neglected to try not just running them standalone. Any thoughts on why it might be showing up on 3.1/3.1 only? |
No idea at the moment. I tried running a bisect through Rails's commit history, but there is a large section around 7.0.0.alpha (or something like that) where specs fail for different reasons (bug in Rails at the time, from what I gather). I may give it another whirl this week, but I'm going to timebox it as I don't want to spend too much longer on this. |
I had another look. The other error that I mention appears for the first time with this Rails commit: rails/rails@cb82f5f This is too esoteric for me, but it does sound related to our issue. I've been playing with it a bit at main...pablobm:administrate:rails70-bisect. I may give it another go, but this is well beyond my expertise. |
I think this may have been introduced in this commit: rails/rails@37081bf
I appear to have found a fix for the issue of lingering constants (see PR description), so I have marked the PR as ready to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
This description has been updated since the PR was first created. The first few comments in the thread reflect the conversation while trying to find a fix to the issue of lingering constants.
Administrate was already compatible with Rails 7, but its specs weren't. This PR includes all necessary fixes, including a workaround for a strange Ruby behaviour when undefining constants on Ruby 3.x.
Specifically,
spec/generators/dashboard_generator_spec.rb
creates a number of classes and then attempts to undefine them, but these appear to linger around, affecting results atspec/generators/routes_generator_spec.rb
. From what I can tell, this affects the specs, but not real world usage.After trying a few things, I ended up with a bit of a hack: in
spec/generators/dashboard_generator_spec.rb
I define those classes to be children ofTestRecord
. Then the routes generator explicitly filter those out.