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

Inherits:
Base
  • 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.'

Instance Method Summary collapse

Methods inherited from Base

inherited, #on_new_investigation

Methods included from RSpec::Language::NodePattern

#block_pattern, #send_pattern

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