@@ -104,6 +104,48 @@ def test_bundler_version_with_bundle_config_version
104104 end
105105 end
106106
107+ def test_bundler_version_with_bundle_version_env_system
108+ ENV [ "BUNDLE_VERSION" ] = "system"
109+
110+ bvf . stub ( :lockfile_contents , "\n \n BUNDLED WITH\n 1.1.1.1\n " ) do
111+ assert_nil bvf . bundler_version
112+ end
113+ end
114+
115+ def test_bundler_version_with_bundle_version_env_overrides_config
116+ ENV [ "BUNDLE_VERSION" ] = "2.3.4"
117+
118+ config_content = <<~CONFIG
119+ BUNDLE_VERSION: "1.2.3"
120+ CONFIG
121+
122+ Tempfile . create ( "bundle_config" ) do |f |
123+ f . write ( config_content )
124+ f . flush
125+
126+ bvf . stub ( :bundler_global_config_file , f . path ) do
127+ assert_equal v ( "2.3.4" ) , bvf . bundler_version
128+ end
129+ end
130+ end
131+
132+ def test_bundler_version_with_empty_bundle_version_env
133+ ENV [ "BUNDLE_VERSION" ] = ""
134+
135+ config_content = <<~CONFIG
136+ BUNDLE_VERSION: "1.2.3"
137+ CONFIG
138+
139+ Tempfile . create ( "bundle_config" ) do |f |
140+ f . write ( config_content )
141+ f . flush
142+
143+ bvf . stub ( :bundler_global_config_file , f . path ) do
144+ assert_equal v ( "1.2.3" ) , bvf . bundler_version
145+ end
146+ end
147+ end
148+
107149 def test_bundler_version_with_bundle_config_non_existent_file
108150 bvf . stub ( :bundler_global_config_file , "/non/existent/path" ) do
109151 assert_nil bvf . bundler_version
0 commit comments