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

Inherits:
RuboCop::Cop show all
Includes:
RSpec::Language, RSpec::SpecOnly
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.'.freeze
FOCUSABLE_SELECTORS =
focusable.to_node_pattern
FOCUSING_SELECTORS =
focused.to_node_pattern
FOCUS_SYMBOL =
s(:sym, :focus)
FOCUS_TRUE =
s(:pair, FOCUS_SYMBOL, s(:true))

Constants included from RSpec::SpecOnly

RSpec::SpecOnly::DEFAULT_CONFIGURATION

Constants included from RSpec::Language

RSpec::Language::ALL

Instance Method Summary collapse

Methods included from RSpec::SpecOnly

#relevant_file?

Instance Method Details

#on_send(node) ⇒ Object



50
51
52
53
54
# File 'lib/rubocop/cop/rspec/focus.rb', line 50

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