lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.6.0 vs lib/rubocop/cop/rspec/example_wording.rb in rubocop-rspec-1.7.0
- old
+ new
@@ -1,13 +1,14 @@
# frozen_string_literal: true
module RuboCop
module Cop
module RSpec
- # Do not use should when describing your tests.
- # see: http://betterspecs.org/#should
+ # Checks that example descriptions do not start with "should".
#
+ # @see http://betterspecs.org/#should
+ #
# The autocorrect is experimental - use with care! It can be configured
# with CustomTransform (e.g. have => has) and IgnoredWords (e.g. only).
#
# @example
# # bad
@@ -16,9 +17,11 @@
#
# # good
# it 'finds nothing' do
# end
class ExampleWording < Cop
+ include RuboCop::RSpec::SpecOnly
+
MSG = 'Do not use should when describing your tests.'.freeze
def on_block(node) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/LineLength
method, = *node
_, method_name, *args = *method