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

Test custom object method call precedence #700

Merged
merged 2 commits into from Apr 2, 2024

Conversation

sullyvannunes
Copy link
Contributor

According to issue #638, it would be better to add coverage to the method call precedence of custom object attribute building.

Comment on lines 38 to 40
to_phlex_attribute_value_klass = Class.new { define_method(:to_phlex_attribute_value, -> { "to_phlex_attribute_value" }) }
to_str_klass = Class.new(to_phlex_attribute_value_klass) { define_method(:to_str, -> { "to_str" }) }
to_s_klass = Class.new(to_str_klass) { define_method(:to_s, -> { "to_s" }) }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would need to be just one class with all three methods defined to ensure the to_phlex_attribute method “wins”.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback @joeldrapper!

I refactored the test so that there is only one class that defines all three methods to ensure correct method call precedence

@joeldrapper
Copy link
Collaborator

Hey @sullyvannunes, thanks so much for the PR. 🙏

I left some feedback on one of the tests.

@joeldrapper joeldrapper merged commit 3a44739 into phlex-ruby:main Apr 2, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants