Add test for private method inheritance visibility#8
Conversation
|
Instead of a unit test, this can be a feature test. The test isn't really testing inheritance, it's testing if a class with a private method is detected to have one, and a class without a private method is detected not to have one. The child inheriting from the parent doesn't really change things, as Lowkey is just focusing on the methods defined in each file, and is not concerned with what methods will be inherited... it doesn't predict what will happen when classes are inherited, it just describes the class it sees. So a better test would be a feature test called something like "detects_private_methods_spec.rb" and the inheritance |
|
Thanks for the catch, @maedi brother I have updated the PR:
Let me know if this looks better now. |
|
Looking good, getting there. We'll later add another test in this spec to actually get the list of private methods in this file. But we can do that later... I think there's an API for that in Lowkey but not sure, can leave for now, the foundations are there |
|
Done @maedi brother. Added the missing newlines, cleaned up the redundant expectation, and updated the spec title. Ready for another look! |
Summary
Adds a test for private method inheritance using a fixture file.
Details
This test checks that:
Context
Related to Issue #4
This is based on the suggested subclass access scenario, where private methods in Ruby are inherited and can be called by subclasses.
@maedi brother, Happy to cover additional cases if needed.