Since now every functionality that changes in Bundler 4 is under a
setting, we can enable that setting to test the new functionality,
without having to run our full CI twice.
This can actually be seen as increasing coverage, because Bundler 4
functionality will now be tested on Windows, MacOS, or any other
environment where previously "Bundler 4 mode" was not running.
1cb3e009fc
This has the following benefits:
* Avoid duplicated work in some specs that first build a repo, and then
overwrite it with a completely different set of gems.
* Reduce RSpec nesting and improve readability.
* The change also made surfaces several specs that were incorrect since
they were unintentionally not testing the right thing.
ed430883e0
If there's a lockfile, but it's out of sync with the Gemfile because a
dependency has been deleted, and frozen mode is set, Bundler will print
the following strange error:
```
$ bundle add rake
, but the lockfile can't be updated because frozen mode is set
You have deleted from the Gemfile:
* rake (~> 13.2)
Run `bundle install` elsewhere and add the updated Gemfile to version control.
```
This commit changes the error to:
```
Some dependencies were deleted from your gemfile, but the lockfile can't be updated because frozen mode is set
You have deleted from the Gemfile:
* rake (~> 13.2)
Run `bundle install` elsewhere and add the updated Gemfile to version control.
```
452da4048d
This error message is also printed when using `bundler/setup` in frozen
model, so we're not necessarily installing any gems when it happens.
This new message play nicer with all situations.
6874bbacce
The `deployment` setting sets `path` to `vendor/bundle` implicitly, but
that should only apply if `path` is not set explicitly, at any level.
3552c064c1
Since we no longer have multiple global sources, each top level dependency is
always pinned to a single source, so it makes little sense to talk about
adding or removing a source. Instead, source changes always mean to
change the source one or more dependencies are pinned to. This logic can
now be much simpler.
f1d33fa0df
The commands these specs run were throwing warnings in bundler 2, and
failing on bundler 3, effectively testing a different scenario to what
they were supposed to.
97ac1ced49
The `gem_command` helper was failing to require `support/hax.rb`, which
takes care of making sure rubygems actually picks up the right `ruby`
executable under ruby-core setup (`ENV["RUBY"]`). This caused binstubs
to be generated with a wrong shebang, and that caused `bundle exec` to
not work. The error message was pretty confusing though due to
https://bugs.ruby-lang.org/issues/16952.
Instead, use the non-deprecated option except when specifically testing
deprecated CLI flags. In that case, pass the flag directly and limit
the specs to `bundler < 3`.
3d5e186241