rubocop-rspec
rubocop-rspec copied to clipboard
Cop idea: suggest using be_an_instance_of
I recently wrote something like this in a spec:
expect(foo.class).to be(Foo)
and then it occurred to me that I could use
expect(foo).to be_an_instance_of(Foo)
If it makes sense to others, I'd be happy to create a BeAnInstanceOf cop to enforce this.
I'm not sure if it fits in this cop idea or should be split into another one, but i also think it would be nice to have something that enforces a preferred alias for be_an_instance_of v.s. be_instance_of and, similarly, be_a/be_an v.s. be_kind_of or be_a_kind_of.