Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update rubocop config for proper linting #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

inkstak
Copy link

@inkstak inkstak commented Jun 7, 2022

FIx rubocop-rspec#1290.
Following discussion in rubocop-rspec#1291.

This PR aims to provide a better rubocop configuration to handle implicit subjects, but also add the following drawback:

its_call(123)         { is_expected.to send_message(Foo, :call).once }
its_call("203000592") { is_expected.to send_message(Foo, :call).once }
RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
  its_call(123)         { is_expected.to send_message(Foo, :call).once }
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RSpec/RepeatedExample: Don't repeat examples within an example group. (https://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/RepeatedExample)
  its_call("203000592") { is_expected.to send_message(Foo, :call).once }

These tests are detected as duplicates because of their similar block content.
Their distinct arguments are interpreted as a description.

This can be circumvented by enhancing the tests but that may not be suitable for every scenario:

its_call(123)         { is_expected.to send_message(Foo, :call).once.with(123) }
its_call("203000592") { is_expected.to send_message(Foo, :call).once.with("203000592") }

@inkstak inkstak force-pushed the proper_rubocop_linting branch from e67220e to d279791 Compare March 14, 2023 10:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RSpec/ImplicitSubject does not use example methods defined by third-party gems
1 participant