Class: RuboCop::Cop::RSpec::Be
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::RSpec::Be
- Defined in:
- lib/rubocop/cop/rspec/be.rb
Overview
Check for expectations where ‘be` is used without argument.
The ‘be` matcher is too generic, as it pass on everything that is not nil or false. If that is the exact intend, use `be_truthy`. In all other cases it’s better to specify what exactly is the expected value.
Constant Summary collapse
- MSG =
'Don\'t use `be` without an argument.'
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
29 30 31 32 33 |
# File 'lib/rubocop/cop/rspec/be.rb', line 29 def on_send(node) be_without_args(node) do |matcher| add_offense(matcher, location: :selector) end end |