-
Notifications
You must be signed in to change notification settings - Fork 2.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
Add Zeitwerk to CALLERS_TO_IGNORE #1831
Add Zeitwerk to CALLERS_TO_IGNORE #1831
Conversation
Without this the app file will be set to zeitwerk/kernel.rb instead of the actual app file since that's what caller_files.first will return.
Is it possible to add a test for this? |
@dentarg I was thinking about it while implementing it, but the only two options of triggering this would be to either add zeitwerk as a dependency (only in test?) or stub If you're OK with one of these solutions then please let me know which one you'd prefer and I'll add a spec using that approach. Alternatively let me know if you can see another way :) |
I was thinking about this solution – yes, only as a test dependency, there's a bunch of other dependencies for tests so that should be fine IMHO. |
@dentarg I tried testing this, but I'm afraid I hit a wall. |
Sorry, I don't know, I would have to give it a try it myself :) |
Can you help me understand the issue? Or how to reproduce it to better undertand? Once you load Zeitwerk, all calls to In any case, Sinatra wants to find the application file among the callers. Whether Zeitwerk is there or not should not matter, no? You walk the callers up until you hit one that does not match any of the patterns. In that logic, patterns that are not found do not conflict, they just won't ever match. |
Apologies for late reply, finally had some time to look into this. @fxn you're absolutely right, this had nothing to do with Zeitwerk. It turns out the bug is only reproducible using Sinatra's classic approach and the test I was trying to extend was using modular. @dentarg I took a stab at this in a separate file since it has to be in classic style in order for this bug to appear, but that messes up with another test and I'm not really sure how to handle that conflict. I committed the test on a separate branch for now, see DawidJanczak@9abff65 The commit message describes the problem, I would appreciate any input you might have on this :) |
@dentarg I spent some more time on this and I'm not sure it's possible to make it work. The failing tests (https://github.com/sinatra/sinatra/blob/master/test/settings_test.rb#L238 and https://github.com/sinatra/sinatra/blob/master/test/settings_test.rb#L506) seem to depend on the file that no classic style app is defined and I need to define that in order to test this bug. The README says "The main disadvantage of using the classic style rather than the modular style is that you will only have one Sinatra application per Ruby process." so I guess it makes sense that this doesn't work. Perhaps that's why there were no tests for this functionality in the first place. Let me know if I'm misunderstanding this please. |
Co-authored-by: Patrik Ragnarsson <patrik@starkast.net>
@DawidJanczak thank you for your perseverance. I'm just going to merge without a test, I appreciate the effort you put into trying to find a way to add one. |
No test was added in sinatra#1831
No test was added in sinatra#1831
Sinatra needs to account for the bundled gems warning system. Probably since ruby/ruby#9148. Add test for classic app using Zeitwerk, as it was so similar and none was added in sinatra#1831.
@DawidJanczak Sorry for never getting back on this, I added test for Zeitwerk in #1975 |
Sinatra needs to account for the bundled gems warning system. Probably since ruby/ruby#9148. Add test for classic app using Zeitwerk, as it was so similar and none was added in sinatra#1831.
Sinatra needs to account for the bundled gems warning system. Probably since ruby/ruby#9148. Add test for classic app using Zeitwerk, as it was so similar and none was added in sinatra#1831.
Sinatra needs to account for the bundled gems warning system. Probably since ruby/ruby#9148. Add test for classic app using Zeitwerk, as it was so similar and none was added in #1831.
Without this the app file will be set to zeitwerk/kernel.rb instead of the actual app file since that's what caller_files.first will return.
Fixes #1826