Class: RuboCop::Cop::RSpec::VoidExpect

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

Overview

This cop checks void ‘expect()`.

Examples:

# bad
expect(something)

# good
expect(something).to be(1)

Constant Summary collapse

MSG =
'Do not use `expect()` without `.to` or `.not_to`. ' \
'Chain the methods or remove it.'

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_block(node) ⇒ Object



32
33
34
35
36
# File 'lib/rubocop/cop/rspec/void_expect.rb', line 32

def on_block(node)
  return unless expect_block?(node)

  check_expect(node)
end

#on_send(node) ⇒ Object



26
27
28
29
30
# File 'lib/rubocop/cop/rspec/void_expect.rb', line 26

def on_send(node)
  return unless expect?(node)

  check_expect(node)
end