class RuboCop::Cop::RSpec::EmptyExampleGroup


end
pending ‘will add tests later’
describe Bacon do
# good
end
end
expect(bacon.chunky?).to be_truthy
it ‘is chunky’ do
let(:chunkiness) { false }
let(:bacon) { Bacon.new(chunkiness) }
describe Bacon do
# good
end
end
expect(bacon.chunky?).to be_truthy
it ‘is chunky’ do
end
let(:chunkiness) { true }
context ‘extra chunky’ do # flagged by rubocop
let(:chunkiness) { false }
let(:bacon) { Bacon.new(chunkiness) }
describe Bacon do
# bad
@example usage
Checks if an example group does not include any tests.

def conditionals_with_examples?(body)

def conditionals_with_examples?(body)
  return false unless body.type?(:begin, :case)
  body.each_descendant(:if, :case).any? do |condition_node|
    examples_in_branches?(condition_node)
  end
end

def examples_in_branches?(condition_node)

def examples_in_branches?(condition_node)
  return false unless condition_node
  return false unless condition_node.type?(:if, :case)
  condition_node.branches.any? { |branch| examples?(branch) }
end

def offensive?(body)

def offensive?(body)
  return true unless body
  return false if conditionals_with_examples?(body)
  if body.type?(:if, :case)
    !examples_in_branches?(body)
  else
    !examples?(body)
  end
end

def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler

rubocop:disable InternalAffairs/NumblockHandler
def on_block(node) # rubocop:disable InternalAffairs/NumblockHandler
  return if node.each_ancestor(:any_def).any?
  return if node.each_ancestor(:block).any? { |block| example?(block) }
  example_group_body(node) do |body|
    next unless offensive?(body)
    add_offense(node.send_node) do |corrector|
      corrector.remove(removed_range(node))
    end
  end
end

def removed_range(node)

def removed_range(node)
  range_by_whole_lines(
    node.source_range,
    include_final_newline: true
  )
end