summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler/source/path.rb2
-rw-r--r--spec/bundler/install/deploy_spec.rb21
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/bundler/source/path.rb b/lib/bundler/source/path.rb
index 6a99f8e977..d4c530e922 100644
--- a/lib/bundler/source/path.rb
+++ b/lib/bundler/source/path.rb
@@ -53,6 +53,8 @@ module Bundler
"source at `#{@path}`"
end
+ alias_method :to_gemfile, :path
+
def hash
[self.class, expanded_path, version].hash
end
diff --git a/spec/bundler/install/deploy_spec.rb b/spec/bundler/install/deploy_spec.rb
index 4b2b0325c8..bd39ac5cc1 100644
--- a/spec/bundler/install/deploy_spec.rb
+++ b/spec/bundler/install/deploy_spec.rb
@@ -483,6 +483,27 @@ RSpec.describe "install in deployment or frozen mode" do
expect(err).not_to include("You have deleted from the Gemfile")
end
+ it "explodes if you change a source from path to git" do
+ build_git "myrack", path: lib_path("myrack")
+
+ install_gemfile <<-G
+ source "https://gem.repo1"
+ gem "myrack", :path => "#{lib_path("myrack")}"
+ G
+
+ gemfile <<-G
+ source "https://gem.repo1"
+ gem "myrack", :git => "https:/my-git-repo-for-myrack"
+ G
+
+ bundle "config set --local frozen true"
+ bundle :install, raise_on_error: false
+ expect(err).to include("frozen mode")
+ expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack")}` to `https:/my-git-repo-for-myrack`")
+ expect(err).not_to include("You have added to the Gemfile")
+ expect(err).not_to include("You have deleted from the Gemfile")
+ end
+
it "remembers that the bundle is frozen at runtime" do
bundle :lock