summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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