Here's a testcase and roughtly what I would expect:
it 'flags hooks that contain heredoc arguments and autocorrects correctly' do
expect_offense(<<~RUBY)
describe Foo do
before { foo }
^^^^^^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 3).
before do
^^^^^^^^^ Do not define multiple `before` hooks in the same example group (also defined on line 2).
bar(<<~'TEXT')
Hello World!
TEXT
end
end
RUBY
expect_correction(<<~RUBY)
describe Foo do
before {
foo
bar(<<~'TEXT')
Hello World!
TEXT
}
end
RUBY
end
The actual autocorrect looks like this, which is not valid syntax (among other things):
Here's a testcase and roughtly what I would expect:
The actual autocorrect looks like this, which is not valid syntax (among other things):