class RuboCop::Cop::RSpec::ScatteredLet


end
let!(:baz) { 3 }
let(:bar) { 2 }
let(:foo) { 1 }
before { prepare }
subject { Foo }
describe Foo do
# good
end
let!(:baz) { 3 }
before { prepare }
let(:bar) { 2 }
subject { Foo }
let(:foo) { 1 }
describe Foo do
# bad
@example
Group lets together
Checks for let scattered across the example group.

def check_let_declarations(node)

def check_let_declarations(node)
  let_found = false
  mix_found = false
  node.each_child_node do |child|
    if let?(child)
      add_offense(child, location: :expression) if mix_found
      let_found = true
    elsif let_found
      mix_found = true
    end
  end
end

def on_block(node)

def on_block(node)
  return unless example_group_with_body?(node)
  _describe, _args, body = *node
  check_let_declarations(body)
end