class RuboCop::Cop::RSpec::EmptyLineAfterHook

Checks if there is an empty line after hook blocks.

@example

# bad
before { do_something }
it { does_something }

# bad
after { do_something }
it { does_something }

# bad
around { |test| test.run }
it { does_something }

# good
before { do_something }

it { does_something }

# good
after { do_something }

it { does_something }

# good
around { |test| test.run }

it { does_something }

Constants

MSG

Public Instance Methods

on_block(node) click to toggle source
# File lib/rubocop/cop/rspec/empty_line_after_hook.rb, line 41
def on_block(node)
  return unless hook?(node)
  return if last_child?(node)

  missing_separating_line(node) do |location|
    add_offense(
      node,
      location: location,
      message: format(MSG, hook: node.method_name)
    )
  end
end