Class: RuboCop::Cop::RSpec::ContainExactly
- Extended by:
- AutoCorrector
- Defined in:
- lib/rubocop/cop/rspec/contain_exactly.rb
Overview
Checks where ‘contain_exactly` is used.
This cop checks for the following:
-
Prefer ‘match_array` when matching array values.
-
Prefer ‘be_empty` when using `contain_exactly` with no arguments.
Constant Summary collapse
- MSG =
'Prefer `match_array` when matching array values.'
- RESTRICT_ON_SEND =
%i[contain_exactly].freeze
Instance Method Summary collapse
Methods inherited from Base
inherited, #on_new_investigation
Methods included from RSpec::Language
#example?, #example_group?, #example_group_with_body?, #explicit_rspec?, #hook?, #include?, #let?, #rspec?, #shared_group?, #spec_group?, #subject?
Instance Method Details
#on_send(node) ⇒ Object
28 29 30 31 32 |
# File 'lib/rubocop/cop/rspec/contain_exactly.rb', line 28 def on_send(node) return if node.arguments.empty? check_populated_collection(node) end |