lib/rubocop/cop/rspec/scattered_setup.rb in rubocop-rspec-2.31.0 vs lib/rubocop/cop/rspec/scattered_setup.rb in rubocop-rspec-3.0.0.pre
- old
+ new
@@ -74,10 +74,10 @@
def autocorrect(corrector, first_occurrence, occurrence)
return if first_occurrence == occurrence || !first_occurrence.body
corrector.insert_after(first_occurrence.body,
- "\n#{occurrence.body.source}")
+ "\n#{occurrence.body&.source}")
corrector.remove(range_by_whole_lines(occurrence.source_range,
include_final_newline: true))
end
end
end