aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/install/gemfile
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-07-24 19:46:19 +0200
committerSHIBATA Hiroshi <hsbt@ruby-lang.org>2019-08-16 14:30:23 +0900
commit6711343d5a630cc857f0fa503b403edb68415f48 (patch)
tree68a06e460c067a5173b4063879bb0db0400d3d8d /spec/bundler/install/gemfile
parentc11c8b69ea98e698e855b4b1f122a54929582dc7 (diff)
downloadruby-6711343d5a630cc857f0fa503b403edb68415f48.tar.gz
[bundler/bundler] Fix inconsistent lockfile order
When Gemfile would specify path sources as relative paths starting with "./", the lockfile would have inconsistent order on `bundle install` and `bundle update`. https://github.com/bundler/bundler/commit/c7532ced89
Diffstat (limited to 'spec/bundler/install/gemfile')
-rw-r--r--spec/bundler/install/gemfile/path_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/bundler/install/gemfile/path_spec.rb b/spec/bundler/install/gemfile/path_spec.rb
index 36750eaf8f..3f2e5bdfc3 100644
--- a/spec/bundler/install/gemfile/path_spec.rb
+++ b/spec/bundler/install/gemfile/path_spec.rb
@@ -83,6 +83,50 @@ RSpec.describe "bundle install with explicit source paths" do
end
end
+ it "sorts paths consistently on install and update when they start with ./" do
+ build_lib "demo", :path => lib_path("demo")
+ build_lib "aaa", :path => lib_path("demo/aaa")
+
+ gemfile = <<-G
+ gemspec
+ gem "aaa", :path => "./aaa"
+ G
+
+ File.open(lib_path("demo/Gemfile"), "w") {|f| f.puts gemfile }
+
+ lockfile = <<~L
+ PATH
+ remote: .
+ specs:
+ demo (1.0)
+
+ PATH
+ remote: aaa
+ specs:
+ aaa (1.0)
+
+ GEM
+ specs:
+
+ PLATFORMS
+ #{lockfile_platforms}
+
+ DEPENDENCIES
+ aaa!
+ demo!
+
+ BUNDLED WITH
+ #{Bundler::VERSION}
+ L
+
+ Dir.chdir(lib_path("demo")) do
+ bundle :install
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
+ bundle :update, :all => true
+ expect(lib_path("demo/Gemfile.lock")).to have_lockfile(lockfile)
+ end
+ end
+
it "expands paths when comparing locked paths to Gemfile paths" do
build_lib "foo", :path => bundled_app("foo-1.0")