Closed marocchino closed 1 month ago
https://github.com/betterspecs/betterspecs/issues/233 Maybe related this issue.
I will make pr part of RSpec/ExpectInHook
as a let containing expect is called in before.
If those people deliberately put expectations inside let’s to escape a cop, what would prevent them from defining a method like ‘def expect_foo’ and using it inside a ‘before’ hook?
I don’t think that our goal is to follow and attempt to flag all those nonsensical usages. We’re more like to enforce the style guide plus help enforce a given styling if several equally acceptable styles exist plus help people avoiding common mistakes. Making an effort against deliberate abuse seems overkill.
BetterSpecs is dead, long live rspec-style-guide that absorbed all good things from betterspecs.
I've noticed that some people use let as an escape from the before hook to avoid
RSpec/ExpectInHook
.so..
will not trigger
RSpec/ExpectInHook
.There is no good reason to put expect inside let in the first place, so I think it would be better to disallow it.