Skip to content

Commit

Permalink
Merge pull request #621 from gemmaro/newer-erb
Browse files Browse the repository at this point in the history
Use the newer ERB.new usage for Ruby v2.6 or higher
  • Loading branch information
mizzy authored Sep 2, 2023
2 parents 22683a0 + e0f6b59 commit 0356747
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/serverspec/setup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ def self.safe_mkdir(dir)
end

def self.safe_create_spec_helper
content = ERB.new(spec_helper_template, nil, '-').result(binding)
erb = if RUBY_VERSION >= "2.6"
ERB.new(spec_helper_template, :trim_mode => '-')
else
ERB.new(spec_helper_template, nil, '-')
end
content = erb.result(binding)
if File.exist? 'spec/spec_helper.rb'
old_content = File.read('spec/spec_helper.rb')
if old_content != content
Expand Down

0 comments on commit 0356747

Please sign in to comment.