File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33module Gem ::BundlerVersionFinder
44 def self . bundler_version
5- return if bundle_config_version == "system"
5+ bcv = bundle_config_version
6+ return if bcv == "system"
67
78 v = ENV [ "BUNDLER_VERSION" ]
89 v = nil if v &.empty?
910
1011 v ||= bundle_update_bundler_version
1112 return if v == true
1213
13- v ||= bundle_config_version
14+ v ||= bcv unless bcv == "lockfile"
1415
1516 v ||= lockfile_version
1617 return unless v
Original file line number Diff line number Diff line change @@ -146,6 +146,31 @@ def test_bundler_version_with_empty_bundle_version_env
146146 end
147147 end
148148
149+ def test_bundler_version_with_bundle_version_env_lockfile
150+ ENV [ "BUNDLE_VERSION" ] = "lockfile"
151+
152+ bvf . stub ( :lockfile_contents , "\n \n BUNDLED WITH\n 1.1.1.1\n " ) do
153+ assert_equal v ( "1.1.1.1" ) , bvf . bundler_version
154+ end
155+ end
156+
157+ def test_bundler_version_with_bundle_config_version_lockfile
158+ config_content = <<~CONFIG
159+ BUNDLE_VERSION: "lockfile"
160+ CONFIG
161+
162+ Tempfile . create ( "bundle_config" ) do |f |
163+ f . write ( config_content )
164+ f . flush
165+
166+ bvf . stub ( :bundler_global_config_file , f . path ) do
167+ bvf . stub ( :lockfile_contents , "\n \n BUNDLED WITH\n 1.1.1.1\n " ) do
168+ assert_equal v ( "1.1.1.1" ) , bvf . bundler_version
169+ end
170+ end
171+ end
172+ end
173+
149174 def test_bundler_version_with_bundle_config_non_existent_file
150175 bvf . stub ( :bundler_global_config_file , "/non/existent/path" ) do
151176 assert_nil bvf . bundler_version
You can’t perform that action at this time.
0 commit comments