Class: RuboCop::Cop::RSpec::Focus

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

Overview

Checks if examples are focused.

Examples:

# bad
describe MyClass, focus: true do
end

describe MyClass, :focus do
end

fdescribe MyClass do
end

# good
describe MyClass do
end

Constant Summary collapse

MSG =
'Focused spec found.'
FOCUSABLE_SELECTORS =
focusable.node_pattern_union
FOCUS_SYMBOL =
s(:sym, :focus)
FOCUS_TRUE =
s(:pair, FOCUS_SYMBOL, s(:true))

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



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

def on_send(node)
  (node) do |focus|
    add_offense(focus, location: :expression)
  end
end