-
Notifications
You must be signed in to change notification settings - Fork 983
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
Fix subclassing deprecated classes #1035
Fix subclassing deprecated classes #1035
Conversation
@technoweenie can you review this since the issues are trickling in |
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 allows the subclassing of classes that were deprecation-wrapped.
Can these commits be squashed into a single one?
429f899
to
f8a8312
Compare
@olleolleolle Squashed to 1 commit |
The version modeled off of activesupport's deprecations methods was causing issues when classes inherited from the deprecated class. Switch to a metaprogrammed class that warns upon initialization. Failing spec for lostisland#1033 rename module to DeprecatedClass Fix incorrect usage of rspec raise_error WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. Update class doc
f8a8312
to
c90dfb5
Compare
Updated the class doc |
Thanks for the repairs! |
@olleolleolle do you know when you're going to release this to rubygems? |
No, I don't know – currently traveling. |
The version modeled off of activesupport's deprecations methods was causing issues when classes inherited from the deprecated class. Switch to a metaprogrammed class that warns upon initialization. Failing spec for lostisland#1033 rename module to DeprecatedClass Fix incorrect usage of rspec raise_error WARNING: Using `expect { }.not_to raise_error(SpecificErrorClass)` risks false positives, since literally any other error would cause the expectation to pass, including those raised by Ruby (e.g. NoMethodError, NameError and ArgumentError), meaning the code you are intending to test may not even get reached. Instead consider using `expect { }.not_to raise_error` or `expect { }.to raise_error(DifferentSpecificErrorClass)`. Update class doc
Description
The previous implementation didn't work because it was setting the constant to an instance of
DeprecatedConstant
which wasn't a class, so therefore couldn't be subclassed.Feel free to critique my implementation and make any suggestions you see fit.
Fixes #1033