dgollahon / rspectre

Exorcise the apparitions haunting your tests.
MIT License
74 stars 9 forks source link

Auto correct for UnusedLet does not play nicely with heredocs #15

Closed backus closed 7 years ago

backus commented 7 years ago

Reproduction:

$ cat repro_spec.rb
RSpec.describe 'reproduction' do
  let(:foo) { <<-EOM }
    this is
    a heredoc
  EOM

  it 'does not use the heredoc' do
  end
end
$ bundle exec rspec repro_spec.rb
Randomized with seed 22964
.

Finished in 0.00073 seconds (files took 0.59494 seconds to load)
1 example, 0 failures

Randomized with seed 22964
$ bundle exec bin/rspectre --rspec='repro_spec.rb' --auto-correct
$ cat repro_spec.rb
RSpec.describe 'reproduction' do

    this is
    a heredoc
  EOM

  it 'does not use the heredoc' do
  end
end
dgollahon commented 7 years ago

Thanks for the report, @backus. I'll check it out soon.

backus commented 7 years ago

🎈!