Skip to content
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

Merged

Conversation

BobbyMcWho
Copy link
Contributor

@BobbyMcWho BobbyMcWho commented Sep 28, 2019

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

@BobbyMcWho BobbyMcWho changed the base branch from master to 0.16.x September 28, 2019 04:58
@BobbyMcWho
Copy link
Contributor Author

@technoweenie can you review this since the issues are trickling in

Copy link
Member

@olleolleolle olleolleolle left a 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?

@BobbyMcWho BobbyMcWho force-pushed the fix-subclassing-deprecated-classes branch from 429f899 to f8a8312 Compare September 28, 2019 14:49
@BobbyMcWho
Copy link
Contributor Author

@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
@BobbyMcWho BobbyMcWho force-pushed the fix-subclassing-deprecated-classes branch from f8a8312 to c90dfb5 Compare September 28, 2019 15:00
@BobbyMcWho
Copy link
Contributor Author

Updated the class doc

@olleolleolle olleolleolle merged commit e4c94ad into lostisland:0.16.x Sep 28, 2019
@olleolleolle
Copy link
Member

Thanks for the repairs!

@BobbyMcWho BobbyMcWho deleted the fix-subclassing-deprecated-classes branch September 28, 2019 16:20
@BobbyMcWho
Copy link
Contributor Author

@olleolleolle do you know when you're going to release this to rubygems?

@olleolleolle
Copy link
Member

No, I don't know – currently traveling.

BobbyMcWho added a commit to BobbyMcWho/faraday that referenced this pull request Sep 30, 2019
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
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.

2 participants