2018-11-02 23:07:56 +00:00
# frozen_string_literal: true
2019-04-14 06:01:35 +00:00
RSpec . describe " major deprecations " do
let ( :warnings ) { err }
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
describe " Bundler " do
2018-11-02 23:07:56 +00:00
before do
2020-06-03 20:46:03 +02:00
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2019-04-14 06:01:35 +00:00
gem " rack "
G
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " .clean_env " do
before do
source = " Bundler.clean_env "
bundle " exec ruby -e #{ source . dump } "
end
2021-02-01 16:17:16 +01:00
it " is deprecated in favor of .unbundled_env " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include \
" `Bundler.clean_env` has been deprecated in favor of `Bundler.unbundled_env`. " \
2019-11-11 17:57:45 +09:00
" If you instead want the environment before bundler was originally loaded, use `Bundler.original_env` " \
" (called at -e:1) "
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " .with_clean_env " do
before do
source = " Bundler.with_clean_env {} "
bundle " exec ruby -e #{ source . dump } "
end
2018-11-02 23:07:56 +00:00
2021-02-01 16:17:16 +01:00
it " is deprecated in favor of .unbundled_env " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include (
" `Bundler.with_clean_env` has been deprecated in favor of `Bundler.with_unbundled_env`. " \
2019-11-11 17:57:45 +09:00
" If you instead want the environment before bundler was originally loaded, use `Bundler.with_original_env` " \
" (called at -e:1) "
2019-04-14 06:01:35 +00:00
)
end
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " .clean_system " do
before do
source = " Bundler.clean_system('ls') "
2018-11-02 23:07:56 +00:00
bundle " exec ruby -e #{ source . dump } "
end
2019-04-14 06:01:35 +00:00
2021-02-01 16:17:16 +01:00
it " is deprecated in favor of .unbundled_system " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include (
" `Bundler.clean_system` has been deprecated in favor of `Bundler.unbundled_system`. " \
2019-11-11 17:57:45 +09:00
" If you instead want to run the command in the environment before bundler was originally loaded, use `Bundler.original_system` " \
" (called at -e:1) "
2019-04-14 06:01:35 +00:00
)
end
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
end
describe " .clean_exec " do
before do
source = " Bundler.clean_exec('ls') "
bundle " exec ruby -e #{ source . dump } "
end
2021-02-01 16:17:16 +01:00
it " is deprecated in favor of .unbundled_exec " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include (
" `Bundler.clean_exec` has been deprecated in favor of `Bundler.unbundled_exec`. " \
2019-11-11 17:57:45 +09:00
" If you instead want to exec to a command in the environment before bundler was originally loaded, use `Bundler.original_exec` " \
" (called at -e:1) "
2019-04-14 06:01:35 +00:00
)
end
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
describe " .environment " do
2019-04-14 06:01:35 +00:00
before do
2018-11-02 23:07:56 +00:00
source = " Bundler.environment "
bundle " exec ruby -e #{ source . dump } "
end
2019-04-14 06:01:35 +00:00
2021-02-01 16:17:16 +01:00
it " is deprecated in favor of .load " , :bundler = > " < 3 " do
2019-11-11 17:57:45 +09:00
expect ( deprecations ) . to include " Bundler.environment has been removed in favor of Bundler.load (called at -e:1) "
2019-04-14 06:01:35 +00:00
end
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2021-08-03 12:18:11 +02:00
describe " bundle exec --no-keep-file-descriptors " do
before do
bundle " exec --no-keep-file-descriptors -e 1 " , :raise_on_error = > false
end
it " is deprecated " , :bundler = > " < 3 " do
expect ( deprecations ) . to include " The `--no-keep-file-descriptors` has been deprecated. `bundle exec` no longer mess with your file descriptors. Close them in the exec'd script if you need to "
end
pending " is removed and shows a helpful error message about it " , :bundler = > " 3 "
end
2019-04-14 06:01:35 +00:00
describe " bundle update --quiet " do
it " does not print any deprecations " do
2020-06-03 18:43:17 +02:00
bundle :update , :quiet = > true , :raise_on_error = > false
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to be_empty
end
end
2019-08-16 12:08:22 +02:00
context " bundle check --path " do
before do
install_gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
2020-06-03 18:43:17 +02:00
bundle " check --path vendor/bundle " , :raise_on_error = > false
2019-08-16 12:08:22 +02:00
end
2021-02-01 16:17:16 +01:00
it " should print a deprecation warning " , :bundler = > " < 3 " do
2020-05-08 14:19:04 +09:00
expect ( deprecations ) . to include (
" The `--path` flag is deprecated because it relies on being " \
" remembered across bundler invocations, which bundler will no " \
2020-10-15 13:20:25 +09:00
" longer do in future versions. Instead please use `bundle config set --local " \
2020-05-08 14:19:04 +09:00
" path 'vendor/bundle'`, and stop using this flag "
)
end
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2020-05-08 14:19:04 +09:00
end
context " bundle check --path= " do
before do
install_gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
2020-06-03 18:43:17 +02:00
bundle " check --path=vendor/bundle " , :raise_on_error = > false
2020-05-08 14:19:04 +09:00
end
2021-02-01 16:17:16 +01:00
it " should print a deprecation warning " , :bundler = > " < 3 " do
2019-08-16 12:08:22 +02:00
expect ( deprecations ) . to include (
" The `--path` flag is deprecated because it relies on being " \
2019-11-11 17:57:45 +09:00
" remembered across bundler invocations, which bundler will no " \
2020-10-15 13:20:25 +09:00
" longer do in future versions. Instead please use `bundle config set --local " \
2019-08-16 12:08:22 +02:00
" path 'vendor/bundle'`, and stop using this flag "
)
end
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2019-08-16 12:08:22 +02:00
end
2020-10-15 13:20:25 +09:00
context " bundle cache --all " do
before do
install_gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
bundle " cache --all " , :raise_on_error = > false
end
2021-02-01 16:17:16 +01:00
it " should print a deprecation warning " , :bundler = > " < 3 " do
2020-10-15 13:20:25 +09:00
expect ( deprecations ) . to include (
" The `--all` flag is deprecated because it relies on being " \
" remembered across bundler invocations, which bundler will no " \
" longer do in future versions. Instead please use `bundle config set " \
" cache_all true`, and stop using this flag "
)
end
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2020-10-15 13:20:25 +09:00
end
2021-04-15 12:47:04 +09:00
context " bundle cache --path " do
before do
install_gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
bundle " cache --path foo " , :raise_on_error = > false
end
it " should print a deprecation warning " , :bundler = > " < 3 " do
expect ( deprecations ) . to include (
" The `--path` flag is deprecated because its semantics are unclear. " \
" Use `bundle config cache_path` to configure the path of your cache of gems, " \
" and `bundle config path` to configure the path where your gems are installed, " \
" and stop using this flag "
)
end
pending " fails with a helpful error " , :bundler = > " 3 "
end
2019-04-14 06:01:35 +00:00
describe " bundle config " do
describe " old list interface " do
before do
2020-06-03 20:45:36 +02:00
bundle " config "
2018-11-02 23:07:56 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config list` instead. " )
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old get interface " do
before do
2020-06-03 20:45:36 +02:00
bundle " config waka "
2019-04-14 06:01:35 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config get waka` instead. " )
end
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old set interface " do
before do
2020-06-03 20:45:36 +02:00
bundle " config waka wakapun "
2019-04-14 06:01:35 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set waka wakapun` instead. " )
end
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old set interface with --local " do
before do
2020-06-03 20:45:36 +02:00
bundle " config --local waka wakapun "
2019-04-14 06:01:35 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --local waka wakapun` instead. " )
end
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old set interface with --global " do
before do
2020-06-03 20:45:36 +02:00
bundle " config --global waka wakapun "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config set --global waka wakapun` instead. " )
end
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old unset interface " do
2018-11-02 23:07:56 +00:00
before do
2020-06-03 20:45:36 +02:00
bundle " config --delete waka "
2018-11-02 23:07:56 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset waka` instead. " )
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful error " , :bundler = > " 3 "
end
describe " old unset interface with --local " do
before do
2020-06-03 20:45:36 +02:00
bundle " config --delete --local waka "
2019-04-14 06:01:35 +00:00
end
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --local waka` instead. " )
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
describe " old unset interface with --global " do
before do
2020-06-03 20:45:36 +02:00
bundle " config --delete --global waka "
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2019-12-14 19:49:16 +09:00
it " warns " , :bundler = > " 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Using the `config` command without a subcommand [list, get, set, unset] is deprecated and will be removed in the future. Use `bundle config unset --global waka` instead. " )
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful error " , :bundler = > " 3 "
end
end
describe " bundle update " do
before do
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2019-04-14 06:01:35 +00:00
gem " rack "
G
end
2019-12-14 19:49:16 +09:00
it " warns when no options are given " , :bundler = > " 3 " do
2020-06-03 20:45:36 +02:00
bundle " update "
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Pass --all to `bundle update` to update everything " )
end
pending " fails with a helpful error when no options are given " , :bundler = > " 3 "
it " does not warn when --all is passed " do
2020-06-03 20:45:36 +02:00
bundle " update --all "
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to be_empty
end
end
describe " bundle install --binstubs " do
before do
install_gemfile <<-G, :binstubs => true
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2019-04-14 06:01:35 +00:00
gem " rack "
G
end
2021-02-01 16:17:16 +01:00
it " should output a deprecation warning " , :bundler = > " < 3 " do
2020-10-15 13:20:25 +09:00
expect ( deprecations ) . to include ( " The --binstubs option will be removed in favor of `bundle binstubs --all` " )
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
context " bundle install with both gems.rb and Gemfile present " do
2018-11-02 23:07:56 +00:00
it " should not warn about gems.rb " do
create_file " gems.rb " , <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-02 23:07:56 +00:00
gem " rack "
G
bundle :install
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to be_empty
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:05:27 +00:00
it " should print a proper warning, and use gems.rb " do
2021-07-25 01:27:02 +10:00
create_file " gems.rb " , " source \" #{ file_uri_for ( gem_repo1 ) } \" "
2020-06-03 20:46:03 +02:00
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-02 23:07:56 +00:00
gem " rack "
G
2019-04-14 06:01:35 +00:00
expect ( warnings ) . to include (
2022-02-09 14:15:54 +01:00
" Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked. "
2019-04-14 06:01:35 +00:00
)
expect ( the_bundle ) . not_to include_gem " rack 1.0 "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
context " bundle install with flags " do
before do
bundle " config set --local path vendor/bundle "
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2019-04-14 06:01:35 +00:00
gem " rack "
G
end
{
2020-05-21 21:05:07 +09:00
" clean " = > [ " clean " , true ] ,
" deployment " = > [ " deployment " , true ] ,
" frozen " = > [ " frozen " , true ] ,
2020-05-25 12:19:13 +02:00
" no-deployment " = > [ " deployment " , false ] ,
2020-05-21 21:05:07 +09:00
" no-prune " = > [ " no_prune " , true ] ,
" path " = > [ " path " , " vendor/bundle " ] ,
" shebang " = > [ " shebang " , " ruby27 " ] ,
" system " = > [ " system " , true ] ,
" without " = > [ " without " , " development " ] ,
" with " = > [ " with " , " development " ] ,
} . each do | name , expectations |
option_name , value = * expectations
2019-04-14 06:01:35 +00:00
flag_name = " -- #{ name } "
context " with the #{ flag_name } flag " do
before do
bundle " install " # to create a lockfile, which deployment or frozen need
bundle " install #{ flag_name } #{ value } "
end
2021-02-01 16:17:16 +01:00
it " should print a deprecation warning " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include (
" The ` #{ flag_name } ` flag is deprecated because it relies on " \
2019-11-11 17:57:45 +09:00
" being remembered across bundler invocations, which bundler " \
2019-04-14 06:01:35 +00:00
" will no longer do in future versions. Instead please use " \
2020-10-15 13:20:25 +09:00
" `bundle config set --local #{ option_name } ' #{ value } '`, and stop using this flag "
2019-04-14 06:01:35 +00:00
)
end
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
end
end
2019-04-14 06:01:35 +00:00
context " bundle install with multiple sources " do
before do
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo3 ) } "
source " #{ file_uri_for ( gem_repo1 ) } "
2019-04-14 06:01:35 +00:00
G
end
2021-02-01 16:17:16 +01:00
it " shows a deprecation " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include (
2022-07-19 12:44:51 +00:00
" Your Gemfile contains multiple global sources. " \
2019-04-14 06:01:35 +00:00
" Using `source` more than once without a block is a security risk, and " \
" may result in installing unexpected gems. To resolve this warning, use " \
2021-04-15 12:47:04 +09:00
" a block to indicate which gems should come from the secondary source. "
2019-04-14 06:01:35 +00:00
)
end
2021-05-28 12:47:49 +02:00
it " doesn't show lockfile deprecations if there's a lockfile " , :bundler = > " < 3 " do
bundle " install "
expect ( deprecations ) . to include (
2022-07-19 12:44:51 +00:00
" Your Gemfile contains multiple global sources. " \
2021-05-28 12:47:49 +02:00
" Using `source` more than once without a block is a security risk, and " \
" may result in installing unexpected gems. To resolve this warning, use " \
" a block to indicate which gems should come from the secondary source. "
)
expect ( deprecations ) . not_to include (
" Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. " \
" Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure. "
)
bundle " config set --local frozen true "
bundle " install "
expect ( deprecations ) . to include (
2022-07-19 12:44:51 +00:00
" Your Gemfile contains multiple global sources. " \
2021-05-28 12:47:49 +02:00
" Using `source` more than once without a block is a security risk, and " \
" may result in installing unexpected gems. To resolve this warning, use " \
" a block to indicate which gems should come from the secondary source. "
)
expect ( deprecations ) . not_to include (
" Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. " \
" Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure. "
)
end
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2019-04-14 06:01:35 +00:00
end
2021-05-28 12:47:49 +02:00
context " bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes " do
2021-04-15 12:47:04 +09:00
before do
build_repo gem_repo3 do
build_gem " rack " , " 0.9.1 "
end
gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
source " #{ file_uri_for ( gem_repo3 ) } " do
gem 'rack'
end
G
lockfile << ~ L
GEM
remote : #{file_uri_for(gem_repo1)}/
remote : #{file_uri_for(gem_repo3)}/
specs :
rack ( 0 . 9 . 1 )
PLATFORMS
ruby
DEPENDENCIES
rack!
BUNDLED WITH
#{Bundler::VERSION}
L
2021-05-28 12:47:49 +02:00
bundle " config set --local frozen true "
2021-04-15 12:47:04 +09:00
end
it " shows a deprecation " , :bundler = > " < 3 " do
bundle " install "
2021-05-28 12:47:49 +02:00
expect ( deprecations ) . to include ( " Your lockfile contains a single rubygems source section with multiple remotes, which is insecure. Make sure you run `bundle install` in non frozen mode and commit the result to make your lockfile secure. " )
2021-04-15 12:47:04 +09:00
end
pending " fails with a helpful error " , :bundler = > " 3 "
end
2018-11-02 23:07:56 +00:00
context " when Bundler.setup is run in a ruby script " do
2019-04-14 06:01:35 +00:00
before do
2021-07-25 01:27:02 +10:00
create_file " gems.rb " , " source \" #{ file_uri_for ( gem_repo1 ) } \" "
2020-06-03 20:46:03 +02:00
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-02 23:07:56 +00:00
gem " rack " , :group = > :test
G
ruby <<-RUBY
2021-05-28 12:47:49 +02:00
require '#{entrypoint}'
2018-11-02 23:07:56 +00:00
Bundler . setup
Bundler . setup
RUBY
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2019-04-14 06:05:27 +00:00
it " should print a single deprecation warning " do
2019-04-14 06:01:35 +00:00
expect ( warnings ) . to include (
2022-02-09 14:15:54 +01:00
" Multiple gemfiles (gems.rb and Gemfile) detected. Make sure you remove Gemfile and Gemfile.lock since bundler is ignoring them in favor of gems.rb and gems.locked. "
2019-04-14 06:01:35 +00:00
)
2018-11-02 23:07:56 +00:00
end
end
context " when `bundler/deployment` is required in a ruby script " do
2019-04-14 06:01:35 +00:00
before do
2020-05-15 21:31:12 +09:00
ruby ( <<-RUBY, :env => env_for_missing_prerelease_default_gem_activation)
2018-11-02 23:07:56 +00:00
require 'bundler/deployment'
RUBY
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2021-02-01 16:17:16 +01:00
it " should print a capistrano deprecation warning " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " Bundler no longer integrates " \
2018-11-02 23:07:56 +00:00
" with Capistrano, but Capistrano provides " \
" its own integration with Bundler via the " \
" capistrano-bundler gem. Use it instead. " )
end
2019-04-14 06:01:35 +00:00
2021-02-01 16:17:16 +01:00
pending " fails with a helpful error " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
context " bundle show " do
2019-04-14 06:01:35 +00:00
before do
2020-06-03 20:46:03 +02:00
install_gemfile <<-G
2019-05-06 18:06:21 +02:00
source " #{ file_uri_for ( gem_repo1 ) } "
2018-11-02 23:07:56 +00:00
gem " rack "
G
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2019-04-14 06:01:35 +00:00
context " with --outdated flag " do
before do
2020-06-03 20:45:36 +02:00
bundle " show --outdated "
2019-04-14 06:01:35 +00:00
end
2021-02-01 16:17:16 +01:00
it " prints a deprecation warning informing about its removal " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include ( " the `--outdated` flag to `bundle show` was undocumented and will be removed without replacement " )
end
pending " fails with a helpful message " , :bundler = > " 3 "
end
2018-11-02 23:07:56 +00:00
end
2021-09-01 09:34:21 +02:00
context " bundle remove " do
before do
gemfile <<-G
source " #{ file_uri_for ( gem_repo1 ) } "
gem " rack "
G
end
context " with --install " do
it " shows a deprecation warning " , :bundler = > " < 3 " do
bundle " remove rack --install "
expect ( err ) . to include " [DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default. "
end
pending " fails with a helpful message " , :bundler = > " 3 "
end
end
2018-11-02 23:07:56 +00:00
context " bundle console " do
2019-04-14 06:01:35 +00:00
before do
2020-06-03 18:43:17 +02:00
bundle " console " , :raise_on_error = > false
2019-04-14 06:01:35 +00:00
end
2018-11-02 23:07:56 +00:00
2021-02-01 16:17:16 +01:00
it " prints a deprecation warning " , :bundler = > " < 3 " do
2019-04-14 06:01:35 +00:00
expect ( deprecations ) . to include \
" bundle console will be replaced by `bin/console` generated by `bundle gem <name>` "
2018-11-02 23:07:56 +00:00
end
2019-04-14 06:01:35 +00:00
pending " fails with a helpful message " , :bundler = > " 3 "
end
context " bundle viz " do
before do
2020-05-15 21:31:12 +09:00
graphviz_version = RUBY_VERSION > = " 2.4 " ? " 1.2.5 " : " 1.2.4 "
realworld_system_gems " ruby-graphviz --version #{ graphviz_version } "
2021-07-25 01:27:02 +10:00
create_file " gems.rb " , " source \" #{ file_uri_for ( gem_repo1 ) } \" "
2019-04-14 06:01:35 +00:00
bundle " viz "
end
2021-02-01 16:17:16 +01:00
it " prints a deprecation warning " , :bundler = > " < 3 " do
2021-11-20 01:15:11 +01:00
expect ( deprecations ) . to include " The `viz` command has been renamed to `graph` and moved to a plugin. See https://github.com/rubygems/bundler-graph "
2019-04-14 06:01:35 +00:00
end
pending " fails with a helpful message " , :bundler = > " 3 "
2018-11-02 23:07:56 +00:00
end
2021-04-15 12:47:04 +09:00
describe " deprecating rubocop " , :readline do
context " bundle gem --rubocop " do
before do
bundle " gem my_new_gem --rubocop " , :raise_on_error = > false
end
it " prints a deprecation warning " , :bundler = > " < 3 " do
expect ( deprecations ) . to include \
" --rubocop is deprecated, use --linter=rubocop "
end
end
context " bundle gem --no-rubocop " do
before do
bundle " gem my_new_gem --no-rubocop " , :raise_on_error = > false
end
it " prints a deprecation warning " , :bundler = > " < 3 " do
expect ( deprecations ) . to include \
" --no-rubocop is deprecated, use --linter "
end
end
context " bundle gem with gem.rubocop set to true " do
before do
bundle " gem my_new_gem " , :env = > { " BUNDLE_GEM__RUBOCOP " = > " true " } , :raise_on_error = > false
end
it " prints a deprecation warning " , :bundler = > " < 3 " do
expect ( deprecations ) . to include \
" config gem.rubocop is deprecated; we've updated your config to use gem.linter instead "
end
end
context " bundle gem with gem.rubocop set to false " do
before do
bundle " gem my_new_gem " , :env = > { " BUNDLE_GEM__RUBOCOP " = > " false " } , :raise_on_error = > false
end
it " prints a deprecation warning " , :bundler = > " < 3 " do
expect ( deprecations ) . to include \
" config gem.rubocop is deprecated; we've updated your config to use gem.linter instead "
end
end
end
2018-11-02 23:07:56 +00:00
end