Skip to content

Enable RSpec/RepeatedExample cop

Igor Drozdov requested to merge id-enable-rspec-repeated-example into master

Description of the proposal

This cop checks for repeated examples within example groups:

it 'is valid' do
  expect(user).to be_valid
end

it 'validates the user' do
  expect(user).to be_valid
end

It would be a useful addition to the static analysis of our tests. The interesting part is that we already have some duplications: #212541 (closed). It would be cool to fix them; however, we need to keep in mind that each case should be tackled individually because in one case it can be simply a duplicated piece of code, while in another one it can be a missed scenario 🤔

Check-list

  • Make sure this MR enables a static analysis check rule for new usage but ignores current offenses
  • Mention this proposal in the relevant Slack channels (e.g. #development, #backend, #frontend)
  • The MR doesn't have significant objections, and is getting a majority of 👍 vs 👎 (remember that we don't need to reach a consensus)
  • Create a follow-up issue to fix the current offenses as a separate iteration: #212541 (closed)
  • Follow the review process as usual

/cc @gitlab-org/maintainers/rails-backend

Edited by Peter Leitzen

Merge request reports