summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2016-03-29 18:43:25 -0500
committerSamuel Giddins <segiddins@segiddins.me>2016-03-29 19:22:26 -0500
commit0cb61b6f09c3ea00becc45eb8ff98e8b59bde385 (patch)
tree999be15687b760f562dddafde7fab1bb60daffef
parentf2c31cd2ea00cd0771cc425da3a18e4226a4c07e (diff)
downloadbundler-seg-no-eval-gemfile-twice.tar.gz
Add a spec for not double-eval'ing a Gemfileseg-no-eval-gemfile-twice
-rw-r--r--lib/bundler/installer.rb2
-rw-r--r--spec/install/gemfile/lockfile_spec.rb25
2 files changed, 26 insertions, 1 deletions
diff --git a/lib/bundler/installer.rb b/lib/bundler/installer.rb
index 4691daf4bc..a6a9362a34 100644
--- a/lib/bundler/installer.rb
+++ b/lib/bundler/installer.rb
@@ -183,7 +183,7 @@ module Bundler
def resolve_if_need(options)
if Bundler.default_lockfile.exist? && !options["update"]
begin
- tmpdef = @definition.without_unlock
+ tmpdef = @definition.with_unlock({})
return unless tmpdef.new_platform? || tmpdef.missing_dependencies.any?
rescue BundlerError
nil
diff --git a/spec/install/gemfile/lockfile_spec.rb b/spec/install/gemfile/lockfile_spec.rb
new file mode 100644
index 0000000000..5d8c6de316
--- /dev/null
+++ b/spec/install/gemfile/lockfile_spec.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+require "spec_helper"
+
+describe "bundle install with a lockfile present" do
+ let(:gf) { <<-G }
+ source "file://#{gem_repo1}"
+
+ gem "rack", "1.0.0"
+ G
+
+ before do
+ install_gemfile(gf)
+ end
+
+ context "gemfile evaluation" do
+ let(:gf) { super() + "\n\n File.open('evals', 'a') {|f| f << %(1\n) }" }
+ it "does not evaluate the gemfile twice" do
+ bundle! :install
+
+ # The first eval is from the initial install, we're testing that the
+ # second install doesn't double-eval
+ expect(bundled_app("evals").read.lines.size).to eq(2)
+ end
+ end
+end