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" 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 =
Examples::PENDING + Examples::SKIPPED \
+ ExampleGroups::SKIPPED
SKIPPABLE_EXAMPLES =
ExampleGroups::GROUPS + Examples::EXAMPLES
SKIPPABLE_SELECTORS =
SKIPPABLE_EXAMPLES.node_pattern_union
SKIP_SYMBOL =
s(:sym, :skip)
PENDING_SYMBOL =
s(:sym, :pending)

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



46
47
48
49
50
# File 'lib/rubocop/cop/rspec/pending.rb', line 46

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

  add_offense(node, location: :expression)
end