[rubygems/rubygems] Make `--quiet` spec independent on the specific warning

We'll be removing the warning about no gem sources, so this spec will no
longer test that warnings are hidden by `--quiet`.

Test that in another way so that we don't lose the coverage when we
drop the specific warning about no gem server sources.

https://github.com/rubygems/rubygems/commit/cce4f86d28
This commit is contained in:
David Rodríguez 2021-07-25 12:35:35 +02:00 коммит произвёл Hiroshi SHIBATA
Родитель 803c60858e
Коммит 24aca87def
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: F9CF13417264FAC2
1 изменённых файлов: 22 добавлений и 4 удалений

Просмотреть файл

@ -588,13 +588,31 @@ RSpec.describe "bundle install with gem sources" do
it "should be quiet" do
bundle "config set force_ruby_platform true"
create_file("install_with_warning.rb", <<~RUBY)
require "#{lib_dir}/bundler"
require "#{lib_dir}/bundler/cli"
require "#{lib_dir}/bundler/cli/install"
module RunWithWarning
def run
super
rescue
Bundler.ui.warn "BOOOOO"
raise
end
end
Bundler::CLI::Install.prepend(RunWithWarning)
RUBY
gemfile <<-G
gem 'rack'
source "#{file_uri_for(gem_repo1)}"
gem 'non-existing-gem'
G
bundle :install, :quiet => true, :raise_on_error => false
expect(err).to include("Could not find gem 'rack'")
expect(err).to_not include("Your Gemfile has no gem server sources")
bundle :install, :quiet => true, :raise_on_error => false, :env => { "RUBYOPT" => "-r#{bundled_app("install_with_warning.rb")}" }
expect(err).to include("Could not find gem 'non-existing-gem'")
expect(err).not_to include("BOOOOO")
end
end