diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-07-04 22:14:19 +0200 |
---|---|---|
committer | David RodrÃguez <deivid.rodriguez@riseup.net> | 2019-07-05 10:31:20 +0200 |
commit | e6a03f11029ea631077331697137e9680649d8b1 (patch) | |
tree | ef0619fe450abe5e706cea3d787f6550b884e068 | |
parent | 102d6229d40d9608317cbd7c961417969bab8a6f (diff) | |
download | bundler-e6a03f11029ea631077331697137e9680649d8b1.tar.gz |
Reuse `lockfile` spec helper
-rw-r--r-- | spec/commands/clean_spec.rb | 4 | ||||
-rw-r--r-- | spec/install/gemfile/git_spec.rb | 6 |
2 files changed, 3 insertions, 7 deletions
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb index 17a533ef19..2243a72b3d 100644 --- a/spec/commands/clean_spec.rb +++ b/spec/commands/clean_spec.rb @@ -568,9 +568,7 @@ RSpec.describe "bundle clean" do gemfile_lock.each_with_index do |line, index| gemfile_lock[index] = line[0..(11 + 7)] if line.include?(" revision:") end - File.open(bundled_app("Gemfile.lock"), "w") do |file| - file.print gemfile_lock.join("\n") - end + lockfile(bundled_app("Gemfile.lock"), gemfile_lock.join("\n")) bundle "install", forgotten_command_line_options(:path => "vendor/bundle") diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb index fe51650f76..f2dcd33d7d 100644 --- a/spec/install/gemfile/git_spec.rb +++ b/spec/install/gemfile/git_spec.rb @@ -1003,10 +1003,8 @@ RSpec.describe "bundle install with git sources" do update_git "valim" new_revision = revision_for(lib_path("valim-1.0")) - lockfile = File.read(bundled_app("Gemfile.lock")) - File.open(bundled_app("Gemfile.lock"), "w") do |file| - file.puts lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}") - end + old_lockfile = File.read(bundled_app("Gemfile.lock")) + lockfile(bundled_app("Gemfile.lock"), old_lockfile.gsub(/revision: #{old_revision}/, "revision: #{new_revision}")) bundle "install" |