Skip to content

Extract def-end snippets ending with "end"-only line properly

Created by: yujinakayama

This fixes snippet extraction so that missing end line in def-end snippet can be extracted properly (similar issue with #2167 (closed)).

RSpec.describe 'def-end snippet extraction with ArgumentError' do
  def foo(arg)
    p arg
  end

  it 'cannot extract the last `end` line' do
    foo
  end
end
Failures:

  1) def-end snippet extraction with ArgumentError cannot extract the last `end` line
     Failure/Error:
       def foo(arg)
         p arg

     ArgumentError:
       wrong number of arguments (given 0, expected 1)

Merge request reports