class Gitlab::Styles::Rubocop::Cop::RSpec::EmptyLineAfterFinalLetItBe

Checks if there is an empty line after the last `let_it_be` block.

@example

# bad
let_it_be(:foo) { bar }
let_it_be(:something) { other }
it { does_something }

# good
let_it_be(:foo) { bar }
let_it_be(:something) { other }

it { does_something }

Constants

MSG

Public Instance Methods

on_block(node) click to toggle source
# File lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb, line 37
def on_block(node)
  return unless example_group_with_body?(node)

  final_let_it_be = node.body.child_nodes.reverse.find { |child| let_it_be?(child) }

  return if final_let_it_be.nil?

  missing_separating_line_offense(final_let_it_be) { MSG }
end