Class: RuboCop::Cop::RSpec::Pending

Inherits:
Cop
  • Object
show all
Defined in:
lib/rubocop/cop/rspec/pending.rb

Overview

Checks for any pending or skipped examples.

Examples:

# bad
describe MyClass do
  it "should be true"
end

describe MyClass do
  it "should be true", skip: true do
    expect(1).to eq(2)
  end
end

describe MyClass do
  it "should be true" do
    pending
  end
end

describe MyClass do
  xit "should be true" do
  end
end

# good
describe MyClass do
end

Constant Summary collapse

MSG =
'Pending spec found.'
PENDING =
Examples::PENDING + Examples::SKIPPED + ExampleGroups::SKIPPED
SKIPPABLE =
ExampleGroups::GROUPS + Examples::EXAMPLES

Constants inherited from Cop

Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE

Constants included from RSpec::Language

RSpec::Language::ALL, RSpec::Language::RSPEC

Instance Method Summary collapse

Methods inherited from Cop

inherited, #relevant_file?

Instance Method Details

#on_send(node) ⇒ Object



52
53
54
55
56
# File 'lib/rubocop/cop/rspec/pending.rb', line 52

def on_send(node)
  return unless pending_block?(node) || skipped?(node)

  add_offense(node)
end