lib/rubocop/cop/rspec/empty_example_cops.rb
def on_block(node)
          return unless it_description?(node)

          unless example_present?(node)
            add_offense(node, message: MSG)
          end
        end
# Checks if an example does not include any expectations.
#
# @example usage
#
#   # bad
#   describe Bacon do
#     let(:bacon)      { Bacon.new(chunkiness) }
#     let(:chunkiness) { true }
#
#     it 'is chunky' do
#       bacon.chunky?
#     end
#   end
#
#   # good
#   describe Bacon do
#     let(:bacon)      { Bacon.new(chunkiness) }
#     let(:chunkiness) { true }
#
#     it 'is chunky' do
#       expect(bacon.chunky?).to be_truthy
#     end
#   end
Checks if an example does not include any expectations.
Checks if an example does not include any expectations .
def on_block(node)
          return unless it_description?(node)
          unless example_present?(node)
            add_offense(node, message: MSG)
          end
        end
def on_block ( node ) return unless it_description? ( node ) unless example_present? ( node ) add_offense ( node , message : MSG ) end end
Checks if an example does not include any expectations.
Checks if an example does not include any expectations .
node
example
usage # bad describe Bacon do let(:bacon) { Bacon.new(chunkiness) } let(:chunkiness) { true } it 'is chunky' do bacon.chunky. end end # good describe Bacon do let(:bacon) { Bacon.new(chunkiness) } let(:chunkiness) { true } it 'is chunky' do expect(bacon.chunky?).to be_truthy end end
usage # bad describe Bacon do let ( : bacon ) { Bacon . new ( chunkiness ) } let ( : chunkiness ) { true } it ' is chunky ' do bacon . chunky . end end # good describe Bacon do let ( : bacon ) { Bacon . new ( chunkiness ) } let ( : chunkiness ) { true } it ' is chunky ' do expect ( bacon . chunky? ) . to be_truthy end end