diff options
author | David RodrÃguez <deivid.rodriguez@riseup.net> | 2020-06-03 18:43:17 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2020-06-18 19:14:15 +0900 |
commit | 61b6f53337cb71b35c56d480ec6044ba7e85cb71 (patch) | |
tree | 02cb7fb6e175c9114a87bee50551334a2f7358fb /spec/bundler/commands | |
parent | 529a9e8a1f804332461a8519fe46dd78f3cb4265 (diff) |
[rubygems/rubygems] Make helpers raise by default
https://github.com/rubygems/rubygems/commit/ade0c441d5
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3212
Diffstat (limited to 'spec/bundler/commands')
22 files changed, 153 insertions, 154 deletions
diff --git a/spec/bundler/commands/add_spec.rb b/spec/bundler/commands/add_spec.rb index 7ea384c1dc..85511aeffb 100644 --- a/spec/bundler/commands/add_spec.rb +++ b/spec/bundler/commands/add_spec.rb @@ -21,7 +21,7 @@ RSpec.describe "bundle add" do context "when no gems are specified" do it "shows error" do - bundle "add" + bundle "add", :raise_on_error => false expect(err).to include("Please specify gems to add") end @@ -129,24 +129,24 @@ RSpec.describe "bundle add" do end it "shows error message when version is not formatted correctly" do - bundle "add 'foo' -v='~>1 . 0'" + bundle "add 'foo' -v='~>1 . 0'", :raise_on_error => false expect(err).to match("Invalid gem requirement pattern '~>1 . 0'") end it "shows error message when gem cannot be found" do bundle "config set force_ruby_platform true" - bundle "add 'werk_it'" + bundle "add 'werk_it'", :raise_on_error => false expect(err).to match("Could not find gem 'werk_it' in") - bundle "add 'werk_it' -s='#{file_uri_for(gem_repo2)}'" + bundle "add 'werk_it' -s='#{file_uri_for(gem_repo2)}'", :raise_on_error => false expect(err).to match("Could not find gem 'werk_it' in rubygems repository") end it "shows error message when source cannot be reached" do - bundle "add 'baz' --source='http://badhostasdf'" + bundle "add 'baz' --source='http://badhostasdf'", :raise_on_error => false expect(err).to include("Could not reach host badhostasdf. Check your network connection and try again.") - bundle "add 'baz' --source='file://does/not/exist'" + bundle "add 'baz' --source='file://does/not/exist'", :raise_on_error => false expect(err).to include("Could not fetch specs from file://does/not/exist/") end @@ -176,7 +176,7 @@ RSpec.describe "bundle add" do describe "with --optimistic and --strict" do it "throws error" do - bundle "add 'foo' --strict --optimistic" + bundle "add 'foo' --strict --optimistic", :raise_on_error => false expect(err).to include("You can not specify `--strict` and `--optimistic` at the same time") end @@ -191,7 +191,7 @@ RSpec.describe "bundle add" do end it "throws error if any of the specified gems are present in the gemfile with different version" do - bundle "add weakling bar" + bundle "add weakling bar", :raise_on_error => false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("You specified: weakling (~> 0.0.1) and weakling (>= 0).") @@ -205,7 +205,7 @@ RSpec.describe "bundle add" do gem "rack", "1.0" G - bundle "add 'rack' --version=1.1" + bundle "add 'rack' --version=1.1", :raise_on_error => false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("If you want to update the gem version, run `bundle update rack`. You may also need to change the version requirement specified in the Gemfile if it's too restrictive") @@ -217,7 +217,7 @@ RSpec.describe "bundle add" do gem "rack", "1.0" G - bundle "add 'rack'" + bundle "add 'rack'", :raise_on_error => false expect(err).to include("Gem already added.") expect(err).to include("You cannot specify the same gem twice with different version requirements") @@ -232,7 +232,7 @@ RSpec.describe "bundle add" do gem "rack" G - bundle "add 'rack' --version=1.1" + bundle "add 'rack' --version=1.1", :raise_on_error => false expect(err).to include("You cannot specify the same gem twice with different version requirements") expect(err).to include("If you want to update the gem version, run `bundle update rack`.") diff --git a/spec/bundler/commands/binstubs_spec.rb b/spec/bundler/commands/binstubs_spec.rb index 8a9f02aee7..79f990d127 100644 --- a/spec/bundler/commands/binstubs_spec.rb +++ b/spec/bundler/commands/binstubs_spec.rb @@ -61,7 +61,7 @@ RSpec.describe "bundle binstubs <gem>" do gem "rack" G - bundle "binstubs" + bundle "binstubs", :raise_on_error => false expect(exitstatus).to eq(1) if exitstatus expect(err).to include("`bundle binstubs` needs at least one gem to run.") end @@ -72,7 +72,7 @@ RSpec.describe "bundle binstubs <gem>" do gem "rack" G - bundle "binstubs rack", :all => true + bundle "binstubs rack", :all => true, :raise_on_error => false expect(last_command).to be_failure expect(err).to include("Cannot specify --all with specific gems") end @@ -90,7 +90,7 @@ RSpec.describe "bundle binstubs <gem>" do file.print "OMG" end - sys_exec "bin/rackup" + sys_exec "bin/rackup", :raise_on_error => false expect(err).to include("was not generated by Bundler") end @@ -126,7 +126,7 @@ RSpec.describe "bundle binstubs <gem>" do context "when BUNDLER_VERSION is set" do it "runs the correct version of bundler" do - sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" } + sys_exec "bin/bundle install", :env => { "BUNDLER_VERSION" => "999.999.999" }, :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -140,7 +140,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install" + sys_exec "bin/bundle install", :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -155,7 +155,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler" do - sys_exec "bin/bundle install" + sys_exec "bin/bundle install", :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 44.0) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 44.0'`") @@ -184,7 +184,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "runs the correct version of bundler when the version is a pre-release" do - sys_exec "bin/bundle install" + sys_exec "bin/bundle install", :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 2.12.a) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 2.12.a'`") @@ -201,7 +201,7 @@ RSpec.describe "bundle binstubs <gem>" do end it "calls through to the explicit bundler version" do - sys_exec "bin/bundle update --bundler=999.999.999" + sys_exec "bin/bundle update --bundler=999.999.999", :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -226,7 +226,7 @@ RSpec.describe "bundle binstubs <gem>" do before { lockfile lockfile.gsub(Bundler::VERSION, "999.999.999") } it "attempts to load that version" do - sys_exec bundled_app("bin/rackup").to_s + sys_exec bundled_app("bin/rackup").to_s, :raise_on_error => false expect(exitstatus).to eq(42) if exitstatus expect(err).to include("Activating bundler (~> 999.999) failed:"). and include("To install the version of bundler this project requires, run `gem install bundler -v '~> 999.999'`") @@ -300,7 +300,7 @@ RSpec.describe "bundle binstubs <gem>" do source "#{file_uri_for(gem_repo1)}" G - bundle "binstubs doesnt_exist" + bundle "binstubs doesnt_exist", :raise_on_error => false expect(exitstatus).to eq(7) if exitstatus expect(err).to include("Could not find gem 'doesnt_exist'.") diff --git a/spec/bundler/commands/cache_spec.rb b/spec/bundler/commands/cache_spec.rb index 33709446c1..8367e2af7f 100644 --- a/spec/bundler/commands/cache_spec.rb +++ b/spec/bundler/commands/cache_spec.rb @@ -255,7 +255,7 @@ RSpec.describe "bundle cache" do subject do bundle "config --local frozen true" - bundle :cache + bundle :cache, :raise_on_error => false end it "tries to install with frozen" do diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb index b662e477b5..81d0a3bc29 100644 --- a/spec/bundler/commands/check_spec.rb +++ b/spec/bundler/commands/check_spec.rb @@ -56,7 +56,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle :check + bundle :check, :raise_on_error => false expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -66,7 +66,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle :check + bundle :check, :raise_on_error => false expect(exitstatus).to be > 0 if exitstatus expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -83,7 +83,7 @@ RSpec.describe "bundle check" do gem "rails_pinned_to_old_activesupport" G - bundle :check + bundle :check, :raise_on_error => false expect(err).to include("Bundler can't satisfy your Gemfile's dependencies.") end @@ -127,7 +127,7 @@ RSpec.describe "bundle check" do gem "rack" G - bundle "check" + bundle "check", :raise_on_error => false expect(err).to include("* rack (1.0.0)") expect(exitstatus).to eq(1) if exitstatus end @@ -195,13 +195,13 @@ RSpec.describe "bundle check" do end it "outputs an error when the default Gemfile is not found" do - bundle :check + bundle :check, :raise_on_error => false expect(exitstatus).to eq(10) if exitstatus expect(err).to include("Could not locate Gemfile") end it "does not output fatal error message" do - bundle :check + bundle :check, :raise_on_error => false expect(exitstatus).to eq(10) if exitstatus expect(err).not_to include("Unfortunately, a fatal error has occurred. ") end @@ -216,7 +216,7 @@ RSpec.describe "bundle check" do bundle! "install" FileUtils.rm(bundled_app_lock) - bundle :check + bundle :check, :raise_on_error => false expect(last_command).to be_failure end @@ -250,7 +250,7 @@ RSpec.describe "bundle check" do gem "rails" G - bundle "check --path vendor/bundle" + bundle "check --path vendor/bundle", :raise_on_error => false end it "returns false" do @@ -278,7 +278,7 @@ RSpec.describe "bundle check" do it "shows what is missing with the current Gemfile if it is not satisfied" do simulate_new_machine - bundle :check + bundle :check, :raise_on_error => false expect(err).to match(/The following gems are missing/) expect(err).to include("* rack (1.0") end @@ -333,7 +333,7 @@ RSpec.describe "bundle check" do context "is older" do it "does not change the lock" do lockfile lock_with("1.10.1") - bundle :check + bundle :check, :raise_on_error => false lockfile_should_be lock_with("1.10.1") end end diff --git a/spec/bundler/commands/clean_spec.rb b/spec/bundler/commands/clean_spec.rb index 0c69585c0b..489f38e902 100644 --- a/spec/bundler/commands/clean_spec.rb +++ b/spec/bundler/commands/clean_spec.rb @@ -326,7 +326,7 @@ RSpec.describe "bundle clean" do gem "rack", "1.0.0" G - bundle :clean + bundle :clean, :raise_on_error => false expect(exitstatus).to eq(15) if exitstatus expect(err).to include("--force") @@ -560,7 +560,7 @@ RSpec.describe "bundle clean" do FileUtils.chmod(0o500, system_cache_path) - bundle :clean, :force => true + bundle :clean, :force => true, :raise_on_error => false expect(err).to include(system_gem_path.to_s) expect(err).to include("grant write permissions") diff --git a/spec/bundler/commands/config_spec.rb b/spec/bundler/commands/config_spec.rb index 898622a1d7..d7fb5107de 100644 --- a/spec/bundler/commands/config_spec.rb +++ b/spec/bundler/commands/config_spec.rb @@ -439,7 +439,7 @@ E bundle! "config set --local foo 4.1" expect(out).to eq "You are replacing the current local value of foo, which is currently \"4\"" - bundle "config set --global --local foo 5" + bundle "config set --global --local foo 5", :raise_on_error => false expect(last_command).to be_failure expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time." end @@ -479,7 +479,7 @@ E expect(out).to eq "" expect(bundle!("config get foo")).to eq "Settings for `foo` in order of priority. The top value will be used\nYou have not configured a value for `foo`" - bundle "config unset foo --local --global" + bundle "config unset foo --local --global", :raise_on_error => false expect(last_command).to be_failure expect(err).to eq "The options global and local were specified. Please only use one of the switches at a time." end diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb index 10eecf19a9..748d951e8f 100644 --- a/spec/bundler/commands/exec_spec.rb +++ b/spec/bundler/commands/exec_spec.rb @@ -168,7 +168,7 @@ RSpec.describe "bundle exec" do context "with default gems" do let(:system_gems_to_install) { [] } - let(:default_irb_version) { ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION" } + let(:default_irb_version) { ruby "gem 'irb', '< 999999'; require 'irb'; puts IRB::VERSION", :raise_on_error => false } context "when not specified in Gemfile" do before do @@ -181,7 +181,6 @@ RSpec.describe "bundle exec" do bundle! "exec irb --version" expect(out).to include(default_irb_version) - expect(err).to be_empty end end @@ -327,7 +326,7 @@ RSpec.describe "bundle exec" do gem "rack" G - bundle "exec foobarbaz" + bundle "exec foobarbaz", :raise_on_error => false expect(exitstatus).to eq(127) if exitstatus expect(err).to include("bundler: command not found: foobarbaz") expect(err).to include("Install missing gem executables with `bundle install`") @@ -339,7 +338,7 @@ RSpec.describe "bundle exec" do G bundle "exec touch foo" - bundle "exec ./foo" + bundle "exec ./foo", :raise_on_error => false expect(exitstatus).to eq(126) if exitstatus expect(err).to include("bundler: not executable: ./foo") end @@ -349,7 +348,7 @@ RSpec.describe "bundle exec" do gem "rack" G - bundle "exec" + bundle "exec", :raise_on_error => false expect(exitstatus).to eq(128) if exitstatus expect(err).to include("bundler: exec needs a command to run") end @@ -362,7 +361,7 @@ RSpec.describe "bundle exec" do G [true, false].each do |l| bundle! "config set disable_exec_load #{l}" - bundle "exec rackup" + bundle "exec rackup", :raise_on_error => false expect(err).to include "can't find executable rackup for gem rack. rack is not currently included in the bundle, perhaps you meant to add it to your Gemfile?" end end @@ -580,7 +579,7 @@ RSpec.describe "bundle exec" do gem "foo", :path => "#{lib_path("foo-1.0")}" G - bundle "exec irb" + bundle "exec irb", :raise_on_error => false expect(err).to match("The gemspec at #{lib_path("foo-1.0").join("foo.gemspec")} is not valid") expect(err).to match('"TODO" is not a summary') @@ -641,7 +640,7 @@ RSpec.describe "bundle exec" do let(:expected) { [exec, args, rack, process].join("\n") } let(:expected_err) { "" } - subject { bundle "exec #{path} arg1 arg2" } + subject { bundle "exec #{path} arg1 arg2", :raise_on_error => false } shared_examples_for "it runs" do it "like a normally executed executable" do @@ -890,7 +889,7 @@ __FILE__: #{path.to_s.inspect} context "with a system gem that shadows a default gem" do let(:openssl_version) { "99.9.9" } - let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil } + let(:expected) { ruby "gem 'openssl', '< 999999'; require 'openssl'; puts OpenSSL::VERSION", :artifice => nil, :raise_on_error => false } it "only leaves the default gem in the stdlib available" do skip "https://github.com/rubygems/bundler/issues/6898" if Gem.win_platform? @@ -927,7 +926,7 @@ __FILE__: #{path.to_s.inspect} skip "ruby_core has openssl and rubygems in the same folder, and this test needs rubygems require but default openssl not in a directly added entry in $LOAD_PATH" if ruby_core? # sanity check that we get the newer, custom version without bundler - sys_exec("#{Gem.ruby} #{file}", :env => env) + sys_exec "#{Gem.ruby} #{file}", :env => env, :raise_on_error => false expect(err).to include("custom openssl should not be loaded") end end diff --git a/spec/bundler/commands/help_spec.rb b/spec/bundler/commands/help_spec.rb index 658b1374d4..33a20dda94 100644 --- a/spec/bundler/commands/help_spec.rb +++ b/spec/bundler/commands/help_spec.rb @@ -72,7 +72,7 @@ RSpec.describe "bundle help" do it "has helpful output when using --help flag for a non-existent command" do with_fake_man do - bundle "instill -h" + bundle "instill -h", :raise_on_error => false end expect(err).to include('Could not find command "instill".') end diff --git a/spec/bundler/commands/info_spec.rb b/spec/bundler/commands/info_spec.rb index bf18395ba6..7e1e41f9f4 100644 --- a/spec/bundler/commands/info_spec.rb +++ b/spec/bundler/commands/info_spec.rb @@ -37,7 +37,7 @@ RSpec.describe "bundle info" do end it "complains if gem not in bundle" do - bundle "info missing" + bundle "info missing", :raise_on_error => false expect(err).to eq("Could not find gem 'missing'.") end @@ -164,7 +164,7 @@ RSpec.describe "bundle info" do invalid_regexp = "[]" - bundle "info #{invalid_regexp}" + bundle "info #{invalid_regexp}", :raise_on_error => false expect(err).to include("Could not find gem '#{invalid_regexp}'.") end end diff --git a/spec/bundler/commands/init_spec.rb b/spec/bundler/commands/init_spec.rb index ed52187115..5f491a62c8 100644 --- a/spec/bundler/commands/init_spec.rb +++ b/spec/bundler/commands/init_spec.rb @@ -15,11 +15,11 @@ RSpec.describe "bundle init" do end it "does not change existing Gemfiles" do - expect { bundle :init }.not_to change { File.read(bundled_app_gemfile) } + expect { bundle :init, :raise_on_error => false }.not_to change { File.read(bundled_app_gemfile) } end it "notifies the user that an existing Gemfile already exists" do - bundle :init + bundle :init, :raise_on_error => false expect(err).to include("Gemfile already exists") end end @@ -48,7 +48,7 @@ RSpec.describe "bundle init" do mode = File.stat(bundled_app(subdir)).mode ^ 0o222 FileUtils.chmod mode, bundled_app(subdir) - bundle :init, :dir => bundled_app(subdir) + bundle :init, :dir => bundled_app(subdir), :raise_on_error => false expect(err).to include("directory is not writable") expect(Dir[bundled_app("#{subdir}/*")]).to be_empty @@ -89,7 +89,7 @@ RSpec.describe "bundle init" do S end - bundle :init, :gemspec => spec_file + bundle :init, :gemspec => spec_file, :raise_on_error => false expect(err).to include("There was an error while loading `test.gemspec`") end end @@ -112,11 +112,11 @@ RSpec.describe "bundle init" do end it "does not change existing Gemfiles" do - expect { bundle :init }.not_to change { File.read(bundled_app("gems.rb")) } + expect { bundle :init, :raise_on_error => false }.not_to change { File.read(bundled_app("gems.rb")) } end it "notifies the user that an existing gems.rb already exists" do - bundle :init + bundle :init, :raise_on_error => false expect(err).to include("gems.rb already exists") end end diff --git a/spec/bundler/commands/inject_spec.rb b/spec/bundler/commands/inject_spec.rb index 78355edab3..fa1bc8fd59 100644 --- a/spec/bundler/commands/inject_spec.rb +++ b/spec/bundler/commands/inject_spec.rb @@ -36,14 +36,14 @@ RSpec.describe "bundle inject", :bundler => "< 3" do context "with injected gems already in the Gemfile" do it "doesn't add existing gems" do - bundle "inject 'rack' '> 0'" + bundle "inject 'rack' '> 0'", :raise_on_error => false expect(err).to match(/cannot specify the same gem twice/i) end end context "incorrect arguments" do it "fails when more than 2 arguments are passed" do - bundle "inject gem_name 1 v" + bundle "inject gem_name 1 v", :raise_on_error => false expect(err).to eq(<<-E.strip) ERROR: "bundle inject" was called with arguments ["gem_name", "1", "v"] Usage: "bundle inject GEM VERSION" @@ -108,7 +108,7 @@ Usage: "bundle inject GEM VERSION" source "#{file_uri_for(gem_repo1)}" gem "rack-obama" G - bundle "inject 'rack' '> 0'" + bundle "inject 'rack' '> 0'", :raise_on_error => false expect(err).to match(/trying to install in deployment mode after changing/) expect(bundled_app_lock.read).not_to match(/rack-obama/) diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb index a090f8b104..f5e094dd7e 100644 --- a/spec/bundler/commands/install_spec.rb +++ b/spec/bundler/commands/install_spec.rb @@ -12,7 +12,7 @@ RSpec.describe "bundle install with gem sources" do end it "does not make a lockfile if the install fails" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false raise StandardError, "FAIL" G @@ -68,7 +68,7 @@ RSpec.describe "bundle install with gem sources" do lockfile = File.read(bundled_app_lock) - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false raise StandardError, "FAIL" G @@ -115,7 +115,7 @@ RSpec.describe "bundle install with gem sources" do end it "raises an appropriate error when gems are specified using symbols" do - install_gemfile(<<-G) + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem :rack G @@ -309,7 +309,7 @@ RSpec.describe "bundle install with gem sources" do end it "gives a useful error if no sources are set" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false gem "rack" G @@ -325,7 +325,7 @@ RSpec.describe "bundle install with gem sources" do context "throws a warning if a gem is added twice in Gemfile" do it "without version requirements" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rack" gem "rack" @@ -337,7 +337,7 @@ RSpec.describe "bundle install with gem sources" do end it "with same versions" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rack", "1.0" gem "rack", "1.0" @@ -351,7 +351,7 @@ RSpec.describe "bundle install with gem sources" do context "throws an error if a gem is added twice in Gemfile" do it "when version of one dependency is not specified" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rack" gem "rack", "1.0" @@ -362,7 +362,7 @@ RSpec.describe "bundle install with gem sources" do end it "when different versions of both dependencies are specified" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rack", "1.0" gem "rack", "1.1" @@ -376,7 +376,7 @@ RSpec.describe "bundle install with gem sources" do it "gracefully handles error when rubygems server is unavailable" do skip "networking issue" if Gem.win_platform? - install_gemfile <<-G, :artifice => nil + install_gemfile <<-G, :artifice => nil, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" source "http://0.0.0.0:9384" do gem 'foo' @@ -400,7 +400,7 @@ RSpec.describe "bundle install with gem sources" do build_gem "ruby-ajp", "1.0.0" end - install_gemfile <<-G, :full_index => true + install_gemfile <<-G, :full_index => true, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "ajp-rails", "0.0.0" @@ -441,7 +441,7 @@ RSpec.describe "bundle install with gem sources" do context "and using an unsupported Ruby version" do it "prints an error" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false ::RUBY_VERSION = '2.0.1' ruby '~> 2.2' G @@ -530,7 +530,7 @@ RSpec.describe "bundle install with gem sources" do gem 'rack' G - bundle :install, :quiet => true + 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") end @@ -549,7 +549,7 @@ RSpec.describe "bundle install with gem sources" do FileUtils.chmod(0o500, bundled_app("vendor")) bundle "config --local path vendor" - bundle :install + bundle :install, :raise_on_error => false expect(err).to include(bundled_app("vendor").to_s) expect(err).to include("grant write permissions") end @@ -581,7 +581,7 @@ RSpec.describe "bundle install with gem sources" do end it "should display a helpful message explaining how to fix it" do - bundle :install, :env => { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" } + bundle :install, :env => { "BUNDLE_RUBYGEMS__ORG" => "user:pass{word" }, :raise_on_error => false expect(exitstatus).to eq(17) if exitstatus expect(err).to eq("Please CGI escape your usernames and passwords before " \ "setting them for authentication.") diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index 60efd38cb7..1f622e5950 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -3,7 +3,7 @@ RSpec.describe "bundle list" do context "with name-only and paths option" do it "raises an error" do - bundle "list --name-only --paths" + bundle "list --name-only --paths", :raise_on_error => false expect(err).to eq "The `--name-only` and `--paths` options cannot be used together" end @@ -11,7 +11,7 @@ RSpec.describe "bundle list" do context "with without-group and only-group option" do it "raises an error" do - bundle "list --without-group dev --only-group test" + bundle "list --without-group dev --only-group test", :raise_on_error => false expect(err).to eq "The `--only-group` and `--without-group` options cannot be used together" end @@ -40,7 +40,7 @@ RSpec.describe "bundle list" do context "when group is not found" do it "raises an error" do - bundle "list --without-group random" + bundle "list --without-group random", :raise_on_error => false expect(err).to eq "`random` group could not be found." end @@ -79,7 +79,7 @@ RSpec.describe "bundle list" do context "when group is not found" do it "raises an error" do - bundle "list --only-group random" + bundle "list --only-group random", :raise_on_error => false expect(err).to eq "`random` group could not be found." end diff --git a/spec/bundler/commands/lock_spec.rb b/spec/bundler/commands/lock_spec.rb index 466f4b739d..c7a1e39773 100644 --- a/spec/bundler/commands/lock_spec.rb +++ b/spec/bundler/commands/lock_spec.rb @@ -84,7 +84,7 @@ RSpec.describe "bundle lock" do end it "does not fetch remote specs when using the --local option" do - bundle "lock --update --local" + bundle "lock --update --local", :raise_on_error => false expect(err).to match(/sources listed in your Gemfile|installed locally/) end @@ -143,7 +143,7 @@ RSpec.describe "bundle lock" do it "errors when updating a missing specific gems using --update" do lockfile @lockfile - bundle "lock --update blahblah" + bundle "lock --update blahblah", :raise_on_error => false expect(err).to eq("Could not find gem 'blahblah'.") expect(read_lockfile).to eq(@lockfile) @@ -247,7 +247,7 @@ RSpec.describe "bundle lock" do end it "errors when removing all platforms" do - bundle "lock --remove-platform #{local_platforms.join(" ")}" + bundle "lock --remove-platform #{local_platforms.join(" ")}", :raise_on_error => false expect(err).to include("Removing all platforms from the bundle is not allowed") end diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index 0aec6811de..a31b28bf85 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -804,22 +804,22 @@ RSpec.describe "bundle gem" do end it "fails gracefully with a ." do - bundle "gem foo.gemspec" + bundle "gem foo.gemspec", :raise_on_error => false expect(err).to end_with("Invalid gem name foo.gemspec -- `Foo.gemspec` is an invalid constant name") end it "fails gracefully with a ^" do - bundle "gem ^" + bundle "gem ^", :raise_on_error => false expect(err).to end_with("Invalid gem name ^ -- `^` is an invalid constant name") end it "fails gracefully with a space" do - bundle "gem 'foo bar'" + bundle "gem 'foo bar'", :raise_on_error => false expect(err).to end_with("Invalid gem name foo bar -- `Foo bar` is an invalid constant name") end it "fails gracefully when multiple names are passed" do - bundle "gem foo bar baz" + bundle "gem foo bar baz", :raise_on_error => false expect(err).to eq(<<-E.strip) ERROR: "bundle gem" was called with arguments ["foo", "bar", "baz"] Usage: "bundle gem NAME [OPTIONS]" @@ -829,7 +829,7 @@ Usage: "bundle gem NAME [OPTIONS]" describe "#ensure_safe_gem_name", :readline do before do - bundle "gem #{subject}" + bundle "gem #{subject}", :raise_on_error => false end context "with an existing const name" do @@ -901,7 +901,7 @@ Usage: "bundle gem NAME [OPTIONS]" context "on conflicts with a previously created file", :readline do it "should fail gracefully" do FileUtils.touch(bundled_app("conflict-foobar")) - bundle "gem conflict-foobar" + bundle "gem conflict-foobar", :raise_on_error => false expect(err).to include("Errno::ENOTDIR") expect(exitstatus).to eql(32) if exitstatus end diff --git a/spec/bundler/commands/open_spec.rb b/spec/bundler/commands/open_spec.rb index 31dc0315ac..83839e4032 100644 --- a/spec/bundler/commands/open_spec.rb +++ b/spec/bundler/commands/open_spec.rb @@ -30,7 +30,7 @@ RSpec.describe "bundle open" do end it "complains if gem not in bundle" do - bundle "open missing", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open missing", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false expect(err).to match(/could not find gem 'missing'/i) end @@ -48,7 +48,7 @@ RSpec.describe "bundle open" do end it "suggests alternatives for similar-sounding gems" do - bundle "open Rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open Rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false expect(err).to match(/did you mean rails\?/i) end @@ -87,7 +87,7 @@ RSpec.describe "bundle open" do end it "opens the editor with a clean env" do - bundle "open", :env => { "EDITOR" => "sh -c 'env'", "VISUAL" => "", "BUNDLER_EDITOR" => "" } + bundle "open", :env => { "EDITOR" => "sh -c 'env'", "VISUAL" => "", "BUNDLER_EDITOR" => "" }, :raise_on_error => false expect(out).not_to include("BUNDLE_GEMFILE=") end end diff --git a/spec/bundler/commands/outdated_spec.rb b/spec/bundler/commands/outdated_spec.rb index 5cbbf8f45c..9b4daa3866 100644 --- a/spec/bundler/commands/outdated_spec.rb +++ b/spec/bundler/commands/outdated_spec.rb @@ -27,7 +27,7 @@ RSpec.describe "bundle outdated" do update_git "zebra", :path => lib_path("zebra") end - bundle "outdated" + bundle "outdated", :raise_on_error => false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -50,7 +50,7 @@ RSpec.describe "bundle outdated" do gem "AAA", "1.0.0" G - bundle "outdated" + bundle "outdated", :raise_on_error => false expected_output = <<~TABLE Gem Current Latest Requested Groups @@ -66,7 +66,7 @@ RSpec.describe "bundle outdated" do update_git "foo", :path => lib_path("foo") end - bundle "outdated" + bundle "outdated", :raise_on_error => false expect(exitstatus).to_not be_zero if exitstatus end @@ -91,7 +91,7 @@ RSpec.describe "bundle outdated" do update_repo2 { build_gem "activesupport", "3.0" } update_repo2 { build_gem "terranova", "9" } - bundle "outdated" + bundle "outdated", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -124,7 +124,7 @@ RSpec.describe "bundle outdated" do gem 'activesupport', '2.3.5' G - bundle "outdated --verbose" + bundle "outdated --verbose", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups Path @@ -157,7 +157,7 @@ RSpec.describe "bundle outdated" do build_gem "duradura", "8.0" end - bundle "outdated --group #{group}" + bundle "outdated --group #{group}", :raise_on_error => false end it "works when the bundle is up to date" do @@ -223,7 +223,7 @@ RSpec.describe "bundle outdated" do end it "returns a sorted list of outdated gems" do - bundle "outdated --groups" + bundle "outdated --groups", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -260,7 +260,7 @@ RSpec.describe "bundle outdated" do build_gem "duradura", "8.0" end - bundle "outdated --groups" + bundle "outdated --groups", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -286,7 +286,7 @@ RSpec.describe "bundle outdated" do gem "activesupport", "2.3.4" G - bundle "outdated --local" + bundle "outdated --local", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -330,13 +330,13 @@ RSpec.describe "bundle outdated" do end describe "with --parseable option" do - subject { bundle "outdated --parseable" } + subject { bundle "outdated --parseable", :raise_on_error => false } it_behaves_like "a minimal output is desired" end describe "with aliased --porcelain option" do - subject { bundle "outdated --porcelain" } + subject { bundle "outdated --porcelain", :raise_on_error => false } it_behaves_like "a minimal output is desired" end @@ -348,7 +348,7 @@ RSpec.describe "bundle outdated" do update_git "foo", :path => lib_path("foo") end - bundle "outdated foo" + bundle "outdated foo", :raise_on_error => false expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip Gem Current Latest Requested Groups @@ -378,7 +378,7 @@ RSpec.describe "bundle outdated" do build_gem "activesupport", "3.0.0.beta" end - bundle "outdated --pre" + bundle "outdated --pre", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -401,7 +401,7 @@ RSpec.describe "bundle outdated" do gem "activesupport", "3.0.0.beta.1" G - bundle "outdated" + bundle "outdated", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -421,7 +421,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "0.0.5" end - bundle :outdated, filter_strict_option => true + bundle :outdated, filter_strict_option => true, :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -455,7 +455,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "0.0.5" end - bundle :outdated, filter_strict_option => true, "filter-patch" => true + bundle :outdated, filter_strict_option => true, "filter-patch" => true, :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -477,7 +477,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "0.1.5" end - bundle :outdated, filter_strict_option => true, "filter-minor" => true + bundle :outdated, filter_strict_option => true, "filter-minor" => true, :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -499,7 +499,7 @@ RSpec.describe "bundle outdated" do build_gem "weakling", "1.1.5" end - bundle :outdated, filter_strict_option => true, "filter-major" => true + bundle :outdated, filter_strict_option => true, "filter-major" => true, :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -513,12 +513,12 @@ RSpec.describe "bundle outdated" do describe "with invalid gem name" do it "returns could not find gem name" do - bundle "outdated invalid_gem_name" + bundle "outdated invalid_gem_name", :raise_on_error => false expect(err).to include("Could not find gem 'invalid_gem_name'.") end it "returns non-zero exit code" do - bundle "outdated invalid_gem_name" + bundle "outdated invalid_gem_name", :raise_on_error => false expect(exitstatus).to_not be_zero if exitstatus end end @@ -531,13 +531,13 @@ RSpec.describe "bundle outdated" do G bundle "config set auto_install 1" - bundle :outdated + bundle :outdated, :raise_on_error => false expect(out).to include("Installing foo 1.0") end context "after bundle install --deployment", :bundler => "< 3" do before do - install_gemfile <<-G, :deployment => true + install_gemfile <<-G, :deployment => true, :raise_on_error => false source "#{file_uri_for(gem_repo2)}" gem "rack" @@ -548,7 +548,7 @@ RSpec.describe "bundle outdated" do it "outputs a helpful message about being in deployment mode" do update_repo2 { build_gem "activesupport", "3.0" } - bundle "outdated" + bundle "outdated", :raise_on_error => false expect(last_command).to be_failure expect(err).to include("You are trying to check outdated gems in deployment mode.") expect(err).to include("Run `bundle outdated` elsewhere.") @@ -571,7 +571,7 @@ RSpec.describe "bundle outdated" do it "outputs a helpful message about being in deployment mode" do update_repo2 { build_gem "activesupport", "3.0" } - bundle "outdated" + bundle "outdated", :raise_on_error => false expect(last_command).to be_failure expect(err).to include("You are trying to check outdated gems in deployment mode.") expect(err).to include("Run `bundle outdated` elsewhere.") @@ -611,7 +611,7 @@ RSpec.describe "bundle outdated" do gem "laduradura", '= 5.15.2', :platforms => [:ruby, :jruby] G - bundle "outdated" + bundle "outdated", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -654,7 +654,7 @@ RSpec.describe "bundle outdated" do end end - subject { bundle "outdated" } + subject { bundle "outdated", :raise_on_error => false } it_behaves_like "version update is detected" end @@ -721,7 +721,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major option" do - subject { bundle "outdated --filter-major" } + subject { bundle "outdated --filter-major", :raise_on_error => false } it_behaves_like "major version updates are detected" it_behaves_like "minor version is ignored" @@ -729,7 +729,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-minor option" do - subject { bundle "outdated --filter-minor" } + subject { bundle "outdated --filter-minor", :raise_on_error => false } it_behaves_like "minor version updates are detected" it_behaves_like "major version is ignored" @@ -737,7 +737,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-patch option" do - subject { bundle "outdated --filter-patch" } + subject { bundle "outdated --filter-patch", :raise_on_error => false } it_behaves_like "patch version updates are detected" it_behaves_like "major version is ignored" @@ -745,7 +745,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-minor --filter-patch options" do - subject { bundle "outdated --filter-minor --filter-patch" } + subject { bundle "outdated --filter-minor --filter-patch", :raise_on_error => false } it_behaves_like "minor version updates are detected" it_behaves_like "patch version updates are detected" @@ -753,7 +753,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-minor options" do - subject { bundle "outdated --filter-major --filter-minor" } + subject { bundle "outdated --filter-major --filter-minor", :raise_on_error => false } it_behaves_like "major version updates are detected" it_behaves_like "minor version updates are detected" @@ -761,7 +761,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-patch options" do - subject { bundle "outdated --filter-major --filter-patch" } + subject { bundle "outdated --filter-major --filter-patch", :raise_on_error => false } it_behaves_like "major version updates are detected" it_behaves_like "patch version updates are detected" @@ -769,7 +769,7 @@ RSpec.describe "bundle outdated" do end describe "with --filter-major --filter-minor --filter-patch options" do - subject { bundle "outdated --filter-major --filter-minor --filter-patch" } + subject { bundle "outdated --filter-major --filter-minor --filter-patch", :raise_on_error => false } it_behaves_like "major version updates are detected" it_behaves_like "minor version updates are detected" @@ -810,7 +810,7 @@ RSpec.describe "bundle outdated" do end it "shows all gems when patching and filtering to patch" do - bundle "outdated --patch --filter-patch" + bundle "outdated --patch --filter-patch", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -823,7 +823,7 @@ RSpec.describe "bundle outdated" do end it "shows minor and major when updating to minor and filtering to patch and minor" do - bundle "outdated --minor --filter-minor" + bundle "outdated --minor --filter-minor", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -835,7 +835,7 @@ RSpec.describe "bundle outdated" do end it "shows minor when updating to major and filtering to minor with parseable" do - bundle "outdated --major --filter-minor --parseable" + bundle "outdated --major --filter-minor --parseable", :raise_on_error => false expect(out).not_to include("patch (newest") expect(out).to include("minor (newest") @@ -877,7 +877,7 @@ RSpec.describe "bundle outdated" do end it "shows gems with update-strict updating to patch and filtering to patch" do - bundle "outdated --patch --update-strict --filter-patch" + bundle "outdated --patch --update-strict --filter-patch", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups @@ -910,7 +910,7 @@ RSpec.describe "bundle outdated" do gem 'weakling' G - bundle "outdated --only-explicit" + bundle "outdated --only-explicit", :raise_on_error => false expected_output = <<~TABLE.strip Gem Current Latest Requested Groups diff --git a/spec/bundler/commands/post_bundle_message_spec.rb b/spec/bundler/commands/post_bundle_message_spec.rb index 5c6112762e..d31818b1bd 100644 --- a/spec/bundler/commands/post_bundle_message_spec.rb +++ b/spec/bundler/commands/post_bundle_message_spec.rb @@ -114,7 +114,7 @@ RSpec.describe "post bundle message" do end it "should report a helpful error message", :bundler => "< 3" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem "rack" gem "not-a-gem", :group => :development @@ -123,7 +123,7 @@ RSpec.describe "post bundle message" do end it "should report a helpful error message", :bundler => "3" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem "rack" gem "not-a-gem", :group => :development @@ -141,7 +141,7 @@ The source does not contain any versions of 'not-a-gem' G bundle :cache expect(bundled_app("vendor/cache/rack-1.0.0.gem")).to exist - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem "rack" gem "not-a-gem", :group => :development diff --git a/spec/bundler/commands/pristine_spec.rb b/spec/bundler/commands/pristine_spec.rb index d572cd2c01..b880477eea 100644 --- a/spec/bundler/commands/pristine_spec.rb +++ b/spec/bundler/commands/pristine_spec.rb @@ -164,7 +164,7 @@ RSpec.describe "bundle pristine", :ruby_repo do end it "raises when one of them is not in the lockfile" do - bundle "pristine abcabcabc" + bundle "pristine abcabcabc", :raise_on_error => false expect(err).to include("Could not find gem 'abcabcabc'.") end end diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 3b255cd03d..04e0aeda82 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -7,7 +7,7 @@ RSpec.describe "bundle remove" do source "#{file_uri_for(gem_repo1)}" G - bundle "remove" + bundle "remove", :raise_on_error => false expect(err).to include("Please specify gems to remove.") end @@ -76,7 +76,7 @@ RSpec.describe "bundle remove" do source "#{file_uri_for(gem_repo1)}" G - bundle "remove rack" + bundle "remove rack", :raise_on_error => false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end @@ -113,7 +113,7 @@ RSpec.describe "bundle remove" do gem "rspec" G - bundle "remove rails rack minitest" + bundle "remove rails rack minitest", :raise_on_error => false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") gemfile_should_be <<-G @@ -340,7 +340,7 @@ RSpec.describe "bundle remove" do gem "rack"; gem "rails" G - bundle "remove rails" + bundle "remove rails", :raise_on_error => false expect(err).to include("Gems could not be removed. rack (>= 0) would also have been removed.") gemfile_should_be <<-G @@ -352,7 +352,7 @@ RSpec.describe "bundle remove" do context "when some gems could not be removed" do it "shows warning for gems not removed and success for those removed" do - install_gemfile <<-G + install_gemfile <<-G, :raise_on_error => false source "#{file_uri_for(gem_repo1)}" gem"rack" gem"rspec" @@ -458,7 +458,7 @@ RSpec.describe "bundle remove" do eval_gemfile "Gemfile-other" G - bundle "remove rack" + bundle "remove rack", :raise_on_error => false expect(err).to include("`rack` is not specified in #{bundled_app_gemfile} so it could not be removed.") end @@ -477,7 +477,7 @@ RSpec.describe "bundle remove" do gem "rack" G - bundle "remove rack" + bundle "remove rack", :raise_on_error => false expect(out).to include("rack was removed.") expect(err).to include("`rack` is not specified in #{bundled_app("Gemfile-other")} so it could not be removed.") @@ -502,7 +502,7 @@ RSpec.describe "bundle remove" do gem "rack" G - bundle "remove rack" + bundle "remove rack", :raise_on_error => false expect(out).to include("rack was removed.") expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") @@ -527,7 +527,7 @@ RSpec.describe "bundle remove" do gem "rails"; gem "rack" G - bundle "remove rack" + bundle "remove rack", :raise_on_error => false expect(err).to include("Gems could not be removed. rails (>= 0) would also have been removed.") expect(bundled_app("Gemfile-other").read).to include("gem \"rack\"") diff --git a/spec/bundler/commands/show_spec.rb b/spec/bundler/commands/show_spec.rb index de3c41f172..481d5ae6e6 100644 --- a/spec/bundler/commands/show_spec.rb +++ b/spec/bundler/commands/show_spec.rb @@ -50,7 +50,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do end it "complains if gem not in bundle" do - bundle "show missing" + bundle "show missing", :raise_on_error => false expect(err).to match(/could not find gem 'missing'/i) end @@ -186,7 +186,7 @@ RSpec.describe "bundle show", :bundler => "< 3" do invalid_regexp = "[]" - bundle "show #{invalid_regexp}" + bundle "show #{invalid_regexp}", :raise_on_error => false expect(err).to include("Could not find gem '#{invalid_regexp}'.") end end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 2618a909d1..116bcfd18b 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -30,7 +30,7 @@ RSpec.describe "bundle update" do gem "rack-obama" exit! G - bundle "update" + bundle "update", :raise_on_error => false expect(bundled_app_lock).to exist end end @@ -53,7 +53,7 @@ RSpec.describe "bundle update" do gem "rack-obama" exit! G - bundle "update", :all => true + bundle "update", :all => true, :raise_on_error => false expect(bundled_app_lock).to exist end end @@ -76,13 +76,13 @@ RSpec.describe "bundle update" do it "errors when passed nothing" do install_gemfile! "" - bundle :update + bundle :update, :raise_on_error => false expect(err).to eq("To update everything, pass the `--all` flag.") end it "errors when passed --all and another option" do install_gemfile! "" - bundle "update --all foo" + bundle "update --all foo", :raise_on_error => false expect(err).to eq("Cannot specify --all along with specific options.") end @@ -113,11 +113,11 @@ RSpec.describe "bundle update" do describe "with an unknown dependency" do it "should inform the user" do - bundle "update halting-problem-solver" + bundle "update halting-problem-solver", :raise_on_error => false expect(err).to include "Could not find gem 'halting-problem-solver'" end it "should suggest alternatives" do - bundle "update platformspecific" + bundle "update platformspecific", :raise_on_error => false expect(err).to include "Did you mean platform_specific?" end end @@ -282,7 +282,7 @@ RSpec.describe "bundle update" do describe "in a frozen bundle" do it "should fail loudly", :bundler => "< 3" do bundle! "install --deployment" - bundle "update", :all => true + bundle "update", :all => true, :raise_on_error => false expect(last_command).to be_failure expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m) @@ -291,14 +291,14 @@ RSpec.describe "bundle update" do it "should suggest different command when frozen is set globally", :bundler => "< 3" do bundle! "config set --global frozen 1" - bundle "update", :all => true + bundle "update", :all => true, :raise_on_error => false expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). and match(/freeze \nby running `bundle config unset frozen`./m) end it "should suggest different command when frozen is set globally", :bundler => "3" do bundle! "config set --global deployment true" - bundle "update", :all => true + bundle "update", :all => true, :raise_on_error => false expect(err).to match(/You are trying to install in deployment mode after changing.your Gemfile/m). and match(/freeze \nby running `bundle config unset deployment`./m) end @@ -631,7 +631,7 @@ RSpec.describe "bundle update when a gem depends on a newer version of bundler" end it "should explain that bundler conflicted", :bundler => "< 3" do - bundle "update", :all => true + bundle "update", :all => true, :raise_on_error => false expect(last_command.stdboth).not_to match(/in snapshot/i) expect(err).to match(/current Bundler version/i). and match(/perhaps you need to update bundler/i) @@ -699,7 +699,7 @@ RSpec.describe "bundle update" do gem "activesupport" G - bundle "update nonexisting" + bundle "update nonexisting", :raise_on_error => false expect(err).to include("This Bundle hasn't been installed yet. Run `bundle install` to update and install the bundled gems.") expect(exitstatus).to eq(22) if exitstatus end @@ -777,7 +777,7 @@ RSpec.describe "bundle update --ruby" do G end it "shows a helpful error message" do - bundle "update --ruby" + bundle "update --ruby", :raise_on_error => false expect(err).to include("Your Ruby version is 2.2.2, but your Gemfile specified ~> 2.1.0") end @@ -1006,7 +1006,7 @@ RSpec.describe "bundle update conservative" do end it "raises if too many flags are provided" do - bundle "update --patch --minor", :all => true + bundle "update --patch --minor", :all => true, :raise_on_error => false expect(err).to eq "Provide only one of the following options: minor, patch" end |