Class: Gitlab::Styles::Rubocop::Cop::RSpec::EmptyLineAfterFinalLetItBe
- Inherits:
-
Base
- Object
- RuboCop::Cop::RSpec::Base
- Base
- Gitlab::Styles::Rubocop::Cop::RSpec::EmptyLineAfterFinalLetItBe
- Extended by:
- RuboCop::Cop::AutoCorrector
- Includes:
- RuboCop::RSpec::EmptyLineSeparation
- Defined in:
- lib/gitlab/styles/rubocop/cop/rspec/empty_line_after_final_let_it_be.rb
Overview
Checks if there is an empty line after the last ‘let_it_be` block.
Constant Summary collapse
- MSG =
'Add an empty line after the last `let_it_be`.'
Constants included from Rspec::Helpers
Rspec::Helpers::LET, Rspec::Helpers::LET_IT_BE_HELPERS
Instance Method Summary collapse
Instance Method Details
#on_block(node) ⇒ Object
37 38 39 40 41 42 43 44 45 |
# 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? (final_let_it_be) { MSG } end |