diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2017-05-25 23:52:46 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2017-05-29 18:41:52 -0500 |
commit | 5161573850d621f002c50cddcbc1ca2d3980a519 (patch) | |
tree | 67a42fb473d0bc2c88dae408ebba209764d2f595 | |
parent | b2bb1a3befd9e0c911da4e7438888fa005e7353d (diff) | |
download | bundler-seg-git-force-no-git-ops.tar.gz |
Add specs for install --force with git specsseg-git-force-no-git-ops
-rw-r--r-- | lib/bundler/installer.rb | 2 | ||||
-rw-r--r-- | spec/install/force_spec.rb | 31 |
2 files changed, 32 insertions, 1 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb index a3e8d3c62d..efad66e202 100644 --- a/lib/bundler/installer.rb +++ b/lib/bundler/installer.rb @@ -215,7 +215,7 @@ module Bundler end def resolve_if_need(options) - if !options["update"] && !options[:inline] && Bundler.default_lockfile.file? + if !options["update"] && !options[:inline] && !options["force"] && Bundler.default_lockfile.file? local = Bundler.ui.silence do begin tmpdef = Definition.build(Bundler.default_gemfile, Bundler.default_lockfile, nil) diff --git a/spec/install/force_spec.rb b/spec/install/force_spec.rb index 6d852b3bf1..dc4956a7ae 100644 --- a/spec/install/force_spec.rb +++ b/spec/install/force_spec.rb @@ -32,5 +32,36 @@ RSpec.describe "bundle install" do expect(out).to include "Installing rack 1.0.0" expect(the_bundle).to include_gems "rack 1.0.0" end + + context "with a git gem" do + let!(:ref) { build_git("foo", "1.0").ref_for("HEAD", 11) } + + before do + gemfile <<-G + gem "foo", :git => "#{lib_path("foo-1.0")}" + G + end + + it "re-installs installed gems" do + foo_lib = default_bundle_path("bundler/gems/foo-1.0-#{ref}/lib/foo.rb") + + bundle! "install" + foo_lib.open("w") {|f| f.write("blah blah blah") } + bundle! "install --force" + + expect(out).to include "Using bundler" + expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" + expect(foo_lib.open(&:read)).to eq("FOO = '1.0'\n") + expect(the_bundle).to include_gems "foo 1.0" + end + + it "works on first bundle install" do + bundle! "install --force" + + expect(out).to include "Using bundler" + expect(out).to include "Using foo 1.0 from #{lib_path("foo-1.0")} (at master@#{ref[0, 7]})" + expect(the_bundle).to include_gems "foo 1.0" + end + end end end |