Class: RuboCop::Cop::RSpec::IteratedExpectation
- Defined in:
- lib/rubocop/cop/rspec/iterated_expectation.rb
Overview
Check that ‘all` matcher is used instead of iterating over an array.
Constant Summary collapse
- MSG =
'Prefer using the `all` matcher instead ' \ 'of iterating over an array.'.freeze
Constants inherited from Cop
Cop::DEFAULT_CONFIGURATION, Cop::DEFAULT_PATTERN_RE
Constants included from RSpec::Language
Instance Method Summary collapse
Methods inherited from Cop
Instance Method Details
#on_block(node) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/rubocop/cop/rspec/iterated_expectation.rb', line 32 def on_block(node) each?(node) do |arg, body| if single_expectation?(body, arg) || only_expectations?(body, arg) add_offense(node.children.first, location: :expression) end end end |