diff options
| author | Jerome Dalbert <jerome.dalbert@gmail.com> | 2024-10-16 19:17:55 -0700 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2024-10-18 16:19:31 +0000 |
| commit | fce5bbd6a7a20c4a559ade1205e3fdb0f5d003d0 (patch) | |
| tree | a4f83d550222c4c5f84d6d04f60fefe44d048b43 /spec | |
| parent | 689f14e255593172abe31a7669b47b528e47214f (diff) | |
[rubygems/rubygems] Add `bundle add --quiet` option
This option is similar to the `bundle install --quiet` option
https://github.com/rubygems/rubygems/commit/3bd773d827
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/commands/add_spec.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index 0a0d4c0046..e63b0b9658 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -284,6 +284,38 @@ RSpec.describe "bundle add" do end end + describe "with --quiet option" do + it "is quiet when there are no warnings" do + bundle "add 'foo' --quiet" + expect(out).to be_empty + expect(err).to be_empty + end + + it "still displays warning and errors" do + create_file("add_with_warning.rb", <<~RUBY) + require "#{lib_dir}/bundler" + require "#{lib_dir}/bundler/cli" + require "#{lib_dir}/bundler/cli/add" + + module RunWithWarning + def run + super + rescue + Bundler.ui.warn "This is a warning" + raise + end + end + + Bundler::CLI::Add.prepend(RunWithWarning) + RUBY + + bundle "add 'non-existing-gem' --quiet", raise_on_error: false, env: { "RUBYOPT" => "-r#{bundled_app("add_with_warning.rb")}" } + expect(out).to be_empty + expect(err).to include("Could not find gem 'non-existing-gem'") + expect(err).to include("This is a warning") + end + end + describe "with --strict option" do it "adds strict version" do bundle "add 'foo' --strict" |
