Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

False positive for RSpec/PendingWithoutReason cop #1733

Open
ydakuka opened this issue Oct 17, 2023 · 2 comments
Open

False positive for RSpec/PendingWithoutReason cop #1733

ydakuka opened this issue Oct 17, 2023 · 2 comments

Comments

@ydakuka
Copy link

ydakuka commented Oct 17, 2023

Describe the solution you'd like:

# good
xspecify do
  pending 'Need to upgrade to the latest HTTP gem version before this will work again.'
  expect(pinger.call).to eq(204)
end

# good
xit 'answers success status' do
  pending 'Need to upgrade to the latest HTTP gem version before this will work again.'
  expect(pinger.call).to eq(200)
end

terminal:

ydakuka@yauhenid:~/Work/main_app$ bin/rails_docker rubocop spec/models/user_spec.rb
Inspecting 1 file
C

Offenses:

spec/models/user_spec.rb:7:3: C: RSpec/PendingWithoutReason: Give the reason for xspecify.
  xspecify do
  ^^^^^^^^
spec/models/user_spec.rb:13:3: C: RSpec/PendingWithoutReason: Give the reason for xit.
  xit 'answers success status' do
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

1 file inspected, 2 offenses detected
@ydakuka
Copy link
Author

ydakuka commented Oct 17, 2023

xspecify and specify should not have a reason docstring (#1658) and the following example will be correct if I run rubocop:

# good
specify do
  pending 'Need to upgrade to the latest HTTP gem version before this will work again.'
  expect(pinger.call).to eq(204)
end

@pirj
Copy link
Member

pirj commented Oct 18, 2023

Pending reason and the docstring are different.

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

No branches or pull requests

2 participants