lib/rubocop/cop/rspec/multiple_expectations.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/multiple_expectations.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -9,11 +9,10 @@
#
# This cop is configurable using the `Max` option
# and works with `--auto-gen-config`.
#
# @example
- #
# # bad
# describe UserCreator do
# it 'builds a user' do
# expect(user.name).to eq("John")
# expect(user.age).to eq(22)
@@ -30,31 +29,28 @@
# expect(user.age).to eq(22)
# end
# end
#
# @example `aggregate_failures: true` (default)
- #
# # good - the cop ignores when RSpec aggregates failures
# describe UserCreator do
# it 'builds a user', :aggregate_failures do
# expect(user.name).to eq("John")
# expect(user.age).to eq(22)
# end
# end
#
# @example `aggregate_failures: false`
- #
# # Detected as an offense
# describe UserCreator do
# it 'builds a user', aggregate_failures: false do
# expect(user.name).to eq("John")
# expect(user.age).to eq(22)
# end
# end
#
# @example configuration
- #
# # .rubocop.yml
# # RSpec/MultipleExpectations:
# # Max: 2
#
# # not flagged by rubocop
@@ -86,10 +82,10 @@
# @!method aggregate_failures_block?(node)
def_node_matcher :aggregate_failures_block?, <<-PATTERN
(block (send nil? :aggregate_failures ...) ...)
PATTERN
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
return unless example?(node)
return if example_with_aggregate_failures?(node)
expectations_count = to_enum(:find_expectation, node).count