rubocop-rspec
rubocop-rspec copied to clipboard
False positive for `RSpec/PendingWithoutReason` cop
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
xspecify and specify should not have a ~reason~ docstring (https://github.com/rubocop/rubocop-rspec/issues/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
Pending reason and the docstring are different.