Module: RuboCop::Cop::RSpec::SkipOrPending

Extended by:
NodePattern::Macros
Included in:
NoExpectationExample, Pending, RepeatedExampleGroupBody, RepeatedExampleGroupDescription
Defined in:
lib/rubocop/cop/rspec/mixin/skip_or_pending.rb

Overview

Helps check offenses with variable definitions

Instance Method Summary collapse

Instance Method Details

#skip_or_pending_inside_block?(node) ⇒ Array<RuboCop::AST::Node>

Match skip/pending statements inside a block (e.g. ‘context`)

Examples:

source that matches

context 'when color is blue' do
  skip 'not implemented yet'
  pending 'not implemented yet'
end

source that does not match

skip 'not implemented yet'
pending 'not implemented yet'

Parameters:

  • node (RuboCop::AST::Node)

Returns:

  • (Array<RuboCop::AST::Node>)

    matching nodes



33
34
35
# File 'lib/rubocop/cop/rspec/mixin/skip_or_pending.rb', line 33

def_node_matcher :skip_or_pending_inside_block?, <<~PATTERN
  (block <(send nil? {:skip :pending} ...) ...>)
PATTERN

#skipped_in_metadata?(node) ⇒ Object



11
12
13
14
15
16
# File 'lib/rubocop/cop/rspec/mixin/skip_or_pending.rb', line 11

def_node_matcher :skipped_in_metadata?, <<~PATTERN
  {
    (send _ _ <(sym {:skip :pending}) ...>)
    (send _ _ ... (hash <(pair (sym {:skip :pending}) { true str dstr }) ...>))
  }
PATTERN