Skip to content

PredicateMatcher recommends changing #key? to matcher be_key #2067

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

Open
bquorning opened this issue Mar 29, 2025 · 0 comments · May be fixed by #2068
Open

PredicateMatcher recommends changing #key? to matcher be_key #2067

bquorning opened this issue Mar 29, 2025 · 0 comments · May be fixed by #2068
Assignees

Comments

@bquorning
Copy link
Collaborator

This is very old, but the cop still forces some odd changes by default:

- expect(hash.key?(:foo)).to be_truthy
+ expect(hash).to be_key(:foo)

From what I've seen, it's possible to configure matchers, but not to which methods it applies. Couldn't some of these methods common methods even be hardcoded? I don't think that anyone using key? would prefer be_key over key?. And if that'd be the case, with the current implementation it'd be possible to configure it using AllowedExplicitMatchers

Originally posted by @dgmora in #466

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 a pull request may close this issue.

1 participant