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

False positive with RSpec/MultipleExpectations cop ? #586

Closed
anthony-robin opened this issue Mar 26, 2018 · 2 comments
Closed

False positive with RSpec/MultipleExpectations cop ? #586

anthony-robin opened this issue Mar 26, 2018 · 2 comments

Comments

@anthony-robin
Copy link
Contributor

anthony-robin commented Mar 26, 2018

I think the RSpec/MultipleExpectations cop detect a false positive in the following case:

def my_method
  Rails.logger.info do
    'my string'
  end
end
it 'has correct logger output' do
  expect(Rails.logger).to have_received(:info) do |&block|
    expect(block.call).to eq 'my string'
  end
end

I got this message:

RSpec/MultipleExpectations: Example has too many expectations [2/1].

Should this case be allowed by rubocop ? Thanks !

- rubocop 0.53.0
- rubocop-rspec 1.24.0
@Darhazer
Copy link
Member

Duplicate of #379 - see for discussion and workarounds

@anthony-robin
Copy link
Contributor Author

Sorry ! Haven't seen it... Thanks !

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

No branches or pull requests

3 participants