summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-06-05 16:42:47 +0800
committerAndre Arko <andre@arko.net>2015-06-08 00:32:21 -0700
commitab41652a553443da83974ca2753852199a63913c (patch)
tree64e4bc3c42b37205f102de8b35c7c114a8f79131
parent00ca9ae0800b61316e973af46e03e8c7d3a0fd07 (diff)
downloadbundler-ab41652a553443da83974ca2753852199a63913c.tar.gz
failing specs for BUNDLED WITH preservation
we want to avoid changing the lock just to add BUNDLED WITH unless the user is explicitly running a Bundler command; implicit locking should not alter the lockfile.
-rw-r--r--spec/commands/check_spec.rb55
-rw-r--r--spec/runtime/setup_spec.rb54
2 files changed, 109 insertions, 0 deletions
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index 6d047597d5..0213f4b7d1 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -275,4 +275,59 @@ describe "bundle check" do
expect(out).to include("* rack (1.0")
end
end
+
+ describe "BUNDLED WITH" do
+ def lock_with(bundler_version = nil)
+ lock = <<-L
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{generic(Gem::Platform.local)}
+
+ DEPENDENCIES
+ rack
+ L
+
+ if bundler_version
+ lock << "\n BUNDLED WITH\n #{bundler_version}\n"
+ end
+
+ lock
+ end
+
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ context "is not present" do
+ it "does not change the lock" do
+ lockfile lock_with(nil)
+ bundle :check
+ lockfile_should_be lock_with(nil)
+ end
+ end
+
+ context "is newer" do
+ it "does not change the lock" do
+ lockfile lock_with(Bundler::VERSION.succ)
+ bundle :check
+ lockfile_should_be lock_with(Bundler::VERSION.succ)
+ end
+ end
+
+ context "is older" do
+ it "does not change the lock" do
+ lockfile lock_with("1.10.1")
+ bundle :check
+ lockfile_should_be lock_with("1.10.1")
+ end
+ end
+ end
+
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index cd9912dcff..2950f925c3 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -899,4 +899,58 @@ describe "Bundler.setup" do
end
end
+ describe "when BUNDLED WITH" do
+ def lock_with(bundler_version = nil)
+ lock = <<-L
+ GEM
+ remote: file:#{gem_repo1}/
+ specs:
+ rack (1.0.0)
+
+ PLATFORMS
+ #{generic(Gem::Platform.local)}
+
+ DEPENDENCIES
+ rack
+ L
+
+ if bundler_version
+ lock << "\n BUNDLED WITH\n #{bundler_version}\n"
+ end
+
+ lock
+ end
+
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ context "is not present" do
+ it "does not change the lock" do
+ lockfile lock_with(nil)
+ ruby "require 'bundler/setup'"
+ lockfile_should_be lock_with(nil)
+ end
+ end
+
+ context "is newer" do
+ it "does not change the lock" do
+ lockfile lock_with(Bundler::VERSION.succ)
+ ruby "require 'bundler/setup'"
+ lockfile_should_be lock_with(Bundler::VERSION.succ)
+ end
+ end
+
+ context "is older" do
+ it "does not change the lock" do
+ lockfile lock_with("1.10.1")
+ ruby "require 'bundler/setup'"
+ lockfile_should_be lock_with("1.10.1")
+ end
+ end
+ end
+
end