rubocop-rspec icon indicating copy to clipboard operation
rubocop-rspec copied to clipboard

[Fix #1337] Update the cop to raise error for insufficient descriptions.

Open akrox58 opened this issue 2 years ago • 3 comments

Per issue #1337, I tried to add a generic way to the ExampleWordingCop to call out insufficient descriptions. For now, I've used "works" and "throws errors" as that is a phrase I see used often as well. I didn't use a new cop since insufficient descriptions seemed to be along the same lines as "should not start with should or it" as they are both description related.


Before submitting the PR make sure the following are checked:

  • [X] Feature branch is up-to-date with master (if not - rebase it).
  • [X] Squashed related commits together.
  • [X] Added tests.
  • [X] Updated documentation.
  • [X] Added an entry to the CHANGELOG.md if the new code introduces user-observable changes.
  • [X] The build (bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).

If you have modified an existing cop's configuration options:

  • [X] Set VersionChanged in config/default.yml to the next major version.

akrox58 avatar Aug 03 '22 07:08 akrox58

Thanks @ydah! How do I get this merged? Do I need to wait for the other reviewers to approve?

akrox58 avatar Aug 05 '22 16:08 akrox58

I would expect the following to pass, but it fails, why?

    expect_no_offenses(<<-'RUBY')
      it "works" \
        "totally fine" do
      end
    RUBY

Looks like I didn't handle that edge case! updated the check to check for the entire description instead, and added some more test cases! Thanks for the catch!

akrox58 avatar Aug 07 '22 17:08 akrox58

I have renamed some of the required CI checks, which unfortunately means that you will need to rebase this branch to make CI pass.

bquorning avatar Sep 12 '22 13:09 bquorning

Rebased and green @bquorning @Darhazer

pirj avatar Oct 10 '22 16:10 pirj

Thank you for the contribution and your time, @akrox58 !

pirj avatar Oct 13 '22 20:10 pirj