lib/rubocop/cop/rspec/repeated_description.rb in rubocop-rspec-2.12.1 vs lib/rubocop/cop/rspec/repeated_description.rb in rubocop-rspec-2.13.0
- old
+ new
@@ -4,47 +4,46 @@
module Cop
module RSpec
# Check for repeated description strings in example groups.
#
# @example
+ # # bad
+ # RSpec.describe User do
+ # it 'is valid' do
+ # # ...
+ # end
#
- # # bad
- # RSpec.describe User do
- # it 'is valid' do
- # # ...
- # end
+ # it 'is valid' do
+ # # ...
+ # end
+ # end
#
- # it 'is valid' do
- # # ...
- # end
+ # # good
+ # RSpec.describe User do
+ # it 'is valid when first and last name are present' do
+ # # ...
# end
#
- # # good
- # RSpec.describe User do
- # it 'is valid when first and last name are present' do
- # # ...
- # end
+ # it 'is valid when last name only is present' do
+ # # ...
+ # end
+ # end
#
- # it 'is valid when last name only is present' do
- # # ...
- # end
+ # # good
+ # RSpec.describe User do
+ # it 'is valid' do
+ # # ...
# end
#
- # # good
- # RSpec.describe User do
- # it 'is valid' do
- # # ...
- # end
- #
- # it 'is valid', :flag do
- # # ...
- # end
+ # it 'is valid', :flag do
+ # # ...
# end
+ # end
#
class RepeatedDescription < Base
MSG = "Don't repeat descriptions within an example group."
- def on_block(node)
+ def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
return unless example_group?(node)
repeated_descriptions(node).each do |repeated_description|
add_offense(repeated_description)
end