Skip to content

Commit 0939b86

Browse files
Merge pull request #8079 from rubygems/deivid-rodriguez/outdated-path
Fix bug report template printed when changing a path source to a git source in frozen mode (cherry picked from commit 04fb70c)
1 parent 5a5e839 commit 0939b86

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

bundler/lib/bundler/source/path.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def to_s
5353
"source at `#{@path}`"
5454
end
5555

56+
alias_method :to_gemfile, :path
57+
5658
def hash
5759
[self.class, expanded_path, version].hash
5860
end

bundler/spec/install/deploy_spec.rb

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@
438438
expect(err).to include("You have changed in the Gemfile:\n* myrack from `no specified source` to `git://hubz.com`")
439439
end
440440

441-
it "explodes if you change a source" do
441+
it "explodes if you change a source from git to the default" do
442442
build_git "myrack"
443443

444444
install_gemfile <<-G
@@ -459,7 +459,7 @@
459459
expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack-1.0")}` to `no specified source`")
460460
end
461461

462-
it "explodes if you change a source" do
462+
it "explodes if you change a source from git to the default, in presence of other git sources" do
463463
build_lib "foo", path: lib_path("myrack/foo")
464464
build_git "myrack", path: lib_path("myrack")
465465

@@ -483,6 +483,27 @@
483483
expect(err).not_to include("You have deleted from the Gemfile")
484484
end
485485

486+
it "explodes if you change a source from path to git" do
487+
build_git "myrack", path: lib_path("myrack")
488+
489+
install_gemfile <<-G
490+
source "https://gem.repo1"
491+
gem "myrack", :path => "#{lib_path("myrack")}"
492+
G
493+
494+
gemfile <<-G
495+
source "https://gem.repo1"
496+
gem "myrack", :git => "https:/my-git-repo-for-myrack"
497+
G
498+
499+
bundle "config set --local frozen true"
500+
bundle :install, raise_on_error: false
501+
expect(err).to include("frozen mode")
502+
expect(err).to include("You have changed in the Gemfile:\n* myrack from `#{lib_path("myrack")}` to `https:/my-git-repo-for-myrack`")
503+
expect(err).not_to include("You have added to the Gemfile")
504+
expect(err).not_to include("You have deleted from the Gemfile")
505+
end
506+
486507
it "remembers that the bundle is frozen at runtime" do
487508
bundle :lock
488509

0 commit comments

Comments
 (0)