lib/rubocop/cop/rspec/example_without_description.rb in rubocop-rspec-2.26.1 vs lib/rubocop/cop/rspec/example_without_description.rb in rubocop-rspec-2.27.0

- old
+ new

@@ -5,28 +5,36 @@ module RSpec # Checks for examples without a description. # # RSpec allows for auto-generated example descriptions when there is no # description provided or the description is an empty one. + # It is acceptable to use `specify` without a description # # This cop removes empty descriptions. # It also defines whether auto-generated description is allowed, based # on the configured style. # # This cop can be configured using the `EnforcedStyle` option # + # @example + # # always good + # specify do + # result = service.call + # expect(result).to be(true) + # end + # # @example `EnforcedStyle: always_allow` (default) # # bad # it('') { is_expected.to be_good } - # it '' do + # specify '' do # result = service.call # expect(result).to be(true) # end # # # good # it { is_expected.to be_good } - # it do + # specify do # result = service.call # expect(result).to be(true) # end # # @example `EnforcedStyle: single_line_only` @@ -73,9 +81,10 @@ private def check_example_without_description(node) return if node.arguments? return unless disallow_empty_description?(node) + return if node.method?(:specify) && node.parent.multiline? add_offense(node, message: MSG_ADD_DESCRIPTION) end def disallow_empty_description?(node)