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

Cop idea: Prevent using expect in let. #1868

Open
marocchino opened this issue Apr 9, 2024 · 0 comments
Open

Cop idea: Prevent using expect in let. #1868

marocchino opened this issue Apr 9, 2024 · 0 comments
Labels

Comments

@marocchino
Copy link
Contributor

I've noticed that some people use let as an escape from the before hook to avoid RSpec/ExpectInHook.

so..

  let(:expect_let) do
    expect(Module).to receive(:call)
  end

  before do
    expect_let
  end

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.

@ydah ydah added the cop label Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants