Skip to content

PredicateMatcher recommends changing #key? to matcher be_key #2067

@bquorning

Description

@bquorning

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions