summaryrefslogtreecommitdiff
path: root/spec/bundler/commands/install_spec.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-07-25 12:35:35 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-07-27 09:25:56 +0900
commit24aca87def4944ebb6bf9e7173dd41920dc10e7a (patch)
tree6898ef2d1c7ff578614bf92ab6323e8b59b37e92 /spec/bundler/commands/install_spec.rb
parent803c60858e42463d33a00950883b17b1c38a2347 (diff)
[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
Diffstat (limited to 'spec/bundler/commands/install_spec.rb')
-rw-r--r--spec/bundler/commands/install_spec.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 208e8e45d3..478ee9c38a 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -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