module RuboCop::Cop::RSpec::AggregateExamples::LineRangeHelpers
@internal Support methods for keeping newlines around examples.
Private Instance Methods
adjacent?(range, another_range)
click to toggle source
# File lib/test_prof/cops/rspec/aggregate_examples/line_range_helpers.rb, line 24 def adjacent?(range, another_range) range.end_pos + 1 == another_range.begin_pos end
range_for_replace(examples)
click to toggle source
# File lib/test_prof/cops/rspec/aggregate_examples/line_range_helpers.rb, line 13 def range_for_replace(examples) range = range_by_whole_lines(examples.first.source_range, include_final_newline: true) next_range = range_by_whole_lines(examples[1].source_range) if adjacent?(range, next_range) range.resize(range.length + 1) else range end end