-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
MONGOID-5661 [Monkey Patch Removal] Add test which checks for monkey patches #5711
MONGOID-5661 [Monkey Patch Removal] Add test which checks for monkey patches #5711
Conversation
@@ -13,6 +13,10 @@ | |||
end | |||
end | |||
|
|||
after do | |||
Symbol.undef_method(:fubar) |
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 spec dynamically monkey-patches Symbol, so I need to clean it up after the spec runs.
Hey Johnny, I like the idea behind this PR -- proactively looking for and reporting on new or removed monkey patches -- but it does not seem to play nice with the I'm not sure if there's a clean way to handle that case or not. Probably we can get by without this spec since the monkey patches in Mongoid seem to be encapsulated neatly in extension modules and are thus relatively easy to keep an eye on. Still, if you have any ideas for how to work around the |
We can just ignore deprecated methods (i.e. not whitelist them in the spec). The point of this spec is only to verify that "no new Monkey Patch methods are inadvertently added." The spec is not intended to assert that "certain Monkey Patch methods are present." |
@jamis I have added a |
43b852e
to
ea16412
Compare
Thanks Johnny. I'm not sure why, but there's just something about this test--the test itself, not the implementation--that bothers me the more I think about it. I think I'm dubious about whether it will actually add value, or just get in the way...but I'm willing to give it the benefit of the doubt for now. I've merged it. We'll see what it does for us! |
Fixes MONGOID-5661
This PR adds a spec to check which kernel monkey patches Mongoid has added. It will help the team to remove them overtime, and will help ensure Mongoid developers do not add new monkey patches going forward.