Skip to content

Add RuboCop rule RSpec/SpecifyExpected

Peter Leitzen requested to merge pl-rspec-specify-expected into master

What does this MR do and why?

This MR adds a 🆕 RSpec/SpecifyExpected as per https://rspec.rubystyle.guide/#it-and-specify.

It checks whether specify is used with is_expected and suggests the use of it.

# bad
specify { is_expected.to eq(true) }

# good
it { is_expected.to eq(true) }

Inspired by gitlab-org/gitlab!132069 (comment 1589555040).

Impact on gitlab-org/gitlab

$ bundle exec rubocop -P -f o --only RSpec/SpecifyExpected

 33749/33749 files |==================================== 100 ====================================>| Time: 00:00:07

226  RSpec/SpecifyExpected
--
226  Total in 49 files

See also gitlab-org/gitlab!133347 (closed) for a preview.

Edited by Peter Leitzen

Merge request reports