diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-05-14 09:58:40 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-05-14 01:27:13 +0000 |
| commit | 3219369142c57ded763d9326081751ef7c4bde9e (patch) | |
| tree | 5467992c58c7b395b364c211423ff198553f9c5e /test | |
| parent | bfba2637246b652aea9d67380b3930e421002e42 (diff) | |
[ruby/rubygems] Fall back to lockfile version when BUNDLE_VERSION is "lockfile"
Bundler treats "lockfile" as a special value for the version setting,
meaning "use the version recorded in BUNDLED WITH". BundlerVersionFinder
was passing the raw string to Gem::Version.new and raising ArgumentError
both from the env var added in #9538 and from .bundle/config.
https://github.com/ruby/rubygems/commit/6576bb8e53
Diffstat (limited to 'test')
| -rw-r--r-- | test/rubygems/test_gem_bundler_version_finder.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_bundler_version_finder.rb b/test/rubygems/test_gem_bundler_version_finder.rb index be8c5914f4..b5ef6293ab 100644 --- a/test/rubygems/test_gem_bundler_version_finder.rb +++ b/test/rubygems/test_gem_bundler_version_finder.rb @@ -146,6 +146,31 @@ class TestGemBundlerVersionFinder < Gem::TestCase end end + def test_bundler_version_with_bundle_version_env_lockfile + ENV["BUNDLE_VERSION"] = "lockfile" + + bvf.stub(:lockfile_contents, "\n\nBUNDLED WITH\n 1.1.1.1\n") do + assert_equal v("1.1.1.1"), bvf.bundler_version + end + end + + def test_bundler_version_with_bundle_config_version_lockfile + config_content = <<~CONFIG + BUNDLE_VERSION: "lockfile" + CONFIG + + Tempfile.create("bundle_config") do |f| + f.write(config_content) + f.flush + + bvf.stub(:bundler_global_config_file, f.path) do + bvf.stub(:lockfile_contents, "\n\nBUNDLED WITH\n 1.1.1.1\n") do + assert_equal v("1.1.1.1"), bvf.bundler_version + end + end + end + end + def test_bundler_version_with_bundle_config_non_existent_file bvf.stub(:bundler_global_config_file, "/non/existent/path") do assert_nil bvf.bundler_version |
