Skip to content

Conversation

@lazycoder9
Copy link
Contributor

@lazycoder9 lazycoder9 commented Feb 9, 2020

Close #873
RSpec/RepeatedDescription will take metadata into account and will not flag examples like below

it 'is valid' 
    # ...
end

it 'is valid', :flag do
    # ...
end

Before submitting the PR make sure the following are checked:

  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Added an entry to the changelog if the new code introduces user-observable changes.
  • 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 created a new cop:

  • Added the new cop to config/default.yml.
  • The cop documents examples of good and bad code.
  • The tests assert both that bad code is reported and that good code is not reported.

@lazycoder9 lazycoder9 force-pushed the fix/repeated_example_description branch from 2000093 to 3fb09b9 Compare February 9, 2020 11:20
@lazycoder9 lazycoder9 requested a review from pirj February 9, 2020 11:20
Copy link
Member

@pirj pirj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! 🙌


grouped_examples
.select { |description, group| description && group.size > 1 }
.select { |signatures, group| !signatures.empty? && group.size > 1 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe signatures.any??
In this case compact below becomes redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@pirj pirj changed the title take metadata into account in repeated example description cop Take metadata into account in RSpec/RepeatedDescription cop Feb 9, 2020
@pirj
Copy link
Member

pirj commented Feb 9, 2020

@bquorning @Darhazer we have plenty of changes to release!

RUBY
end

it 'does not flag examples if metadata is different' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if there is the same metatada? with same description? With different descriptions?
I would convert this to a context and add a couple of more examples

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added two more tests

@Darhazer
Copy link
Member

@bquorning @Darhazer we have plenty of changes to release!

Unfortunately, I don't have access to rubygems to push releases. But I agree, let's release a new version after this one is merged

@bquorning
Copy link
Collaborator

I’ll release a new version after this PR has been merged. As mentioned by @Darhazer, we should probably have a few more specs first.

@lazycoder9 lazycoder9 force-pushed the fix/repeated_example_description branch from 3fb09b9 to 5024a13 Compare February 10, 2020 19:17
@lazycoder9 lazycoder9 requested a review from bquorning February 10, 2020 19:18
Copy link
Collaborator

@bquorning bquorning left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🎉

@bquorning bquorning merged commit 292f6cb into rubocop:master Feb 10, 2020
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

Successfully merging this pull request may close these issues.

RSpec/RepeatedDescription take metadata into account

4 participants