1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] Make helpers raise by default

ade0c441d5
This commit is contained in:
David Rodríguez 2020-06-03 18:43:17 +02:00 committed by Hiroshi SHIBATA
parent 529a9e8a1f
commit 61b6f53337
Notes: git 2020-06-18 19:15:18 +09:00
61 changed files with 378 additions and 390 deletions

View file

@ -4,12 +4,12 @@ require "bundler/cli"
RSpec.describe "bundle executable" do
it "returns non-zero exit status when passed unrecognized options" do
bundle "--invalid_argument"
bundle "--invalid_argument", :raise_on_error => false
expect(exitstatus).to_not be_zero if exitstatus
end
it "returns non-zero exit status when passed unrecognized task" do
bundle "unrecognized-task"
bundle "unrecognized-task", :raise_on_error => false
expect(exitstatus).to_not be_zero if exitstatus
end
@ -141,7 +141,7 @@ RSpec.describe "bundle executable" do
describe "printing the outdated warning" do
shared_examples_for "no warning" do
it "prints no warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false
expect(last_command.stdboth).to eq("Could not find command \"fail\".")
end
end
@ -176,7 +176,7 @@ RSpec.describe "bundle executable" do
context "when the latest version is greater than the current version" do
let(:latest_version) { "222.0" }
it "prints the version warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false
expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler`
@ -193,7 +193,7 @@ To install the latest version, run `gem install bundler`
bundle! "config get --parseable foo", :env => { "BUNDLER_VERSION" => bundler_version }
expect(last_command.stdboth).to eq ""
bundle "platform --ruby", :env => { "BUNDLER_VERSION" => bundler_version }
bundle "platform --ruby", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false
expect(last_command.stdboth).to eq "Could not locate Gemfile"
end
end
@ -201,7 +201,7 @@ To install the latest version, run `gem install bundler`
context "and is a pre-release" do
let(:latest_version) { "222.0.0.pre.4" }
it "prints the version warning" do
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }
bundle "fail", :env => { "BUNDLER_VERSION" => bundler_version }, :raise_on_error => false
expect(err).to start_with(<<-EOS.strip)
The latest bundler is #{latest_version}, but you are currently running #{bundler_version}.
To install the latest version, run `gem install bundler --pre`

View file

@ -137,7 +137,7 @@ RSpec.describe "bundle cache" do
gem 'builtin_gem', '1.0.2'
G
bundle :cache
bundle :cache, :raise_on_error => false
expect(exitstatus).to_not eq(0) if exitstatus
expect(err).to include("builtin_gem-1.0.2 is built in to Ruby, and can't be cached")
end

View file

@ -139,7 +139,7 @@ RSpec.describe "bundle cache with path" do
gem "baz", :path => '#{lib_path("baz-1.0")}'
G
bundle "cache --no-all"
bundle "cache --no-all", :raise_on_error => false
expect(bundled_app("vendor/cache/baz-1.0")).not_to exist
end
end

View file

@ -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`.")

View file

@ -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'.")

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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/)

View file

@ -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.")

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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\"")

View file

@ -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

View file

@ -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

View file

@ -15,7 +15,7 @@ RSpec.describe "bundle install with :allow_offline_install" do
end
it "still fails when the network is down" do
install_gemfile <<-G, :artifice => "fail"
install_gemfile <<-G, :artifice => "fail", :raise_on_error => false
source "http://testgemserver.local"
gem "rack-obama"
G

View file

@ -32,7 +32,7 @@ RSpec.describe "bundle install" do
it "causes a conflict if explicitly requesting a different version" do
bundle "config set force_ruby_platform true"
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rails", "3.0"
gem "bundler", "0.9.2"
@ -93,7 +93,7 @@ RSpec.describe "bundle install" do
it "causes a conflict if child dependencies conflict" do
bundle "config set force_ruby_platform true"
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "activemerchant"
gem "rails_pinned_to_old_activesupport"
@ -114,7 +114,7 @@ RSpec.describe "bundle install" do
it "causes a conflict if a child dependency conflicts with the Gemfile" do
bundle "config set force_ruby_platform true"
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rails_pinned_to_old_activesupport"
gem "activesupport", "2.3.5"

View file

@ -10,24 +10,24 @@ RSpec.describe "install in deployment or frozen mode" do
context "with CLI flags", :bundler => "< 3" do
it "fails without a lockfile and says that --deployment requires a lock" do
bundle "install --deployment"
bundle "install --deployment", :raise_on_error => false
expect(err).to include("The --deployment flag requires a Gemfile.lock")
end
it "fails without a lockfile and says that --frozen requires a lock" do
bundle "install --frozen"
bundle "install --frozen", :raise_on_error => false
expect(err).to include("The --frozen flag requires a Gemfile.lock")
end
it "disallows --deployment --system" do
bundle "install --deployment --system"
bundle "install --deployment --system", :raise_on_error => false
expect(err).to include("You have specified both --deployment")
expect(err).to include("Please choose only one option")
expect(exitstatus).to eq(15) if exitstatus
end
it "disallows --deployment --path --system" do
bundle "install --deployment --path . --system"
bundle "install --deployment --path . --system", :raise_on_error => false
expect(err).to include("You have specified both --path")
expect(err).to include("as well as --system")
expect(err).to include("Please choose only one option")
@ -35,7 +35,7 @@ RSpec.describe "install in deployment or frozen mode" do
end
it "doesn't mess up a subsequent `bundle install` after you try to deploy without a lock" do
bundle "install --deployment"
bundle "install --deployment", :raise_on_error => false
bundle! :install
expect(the_bundle).to include_gems "rack 1.0"
end
@ -135,7 +135,7 @@ RSpec.describe "install in deployment or frozen mode" do
end
it "prevents the replace by default" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/The list of sources changed/)
end
@ -154,7 +154,7 @@ RSpec.describe "install in deployment or frozen mode" do
before { bundle! "config set allow_deployment_source_credential_changes false" }
it "prevents the replace" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/The list of sources changed/)
end
@ -174,7 +174,7 @@ RSpec.describe "install in deployment or frozen mode" do
before { ENV["BUNDLE_ALLOW_DEPLOYMENT_SOURCE_CREDENTIAL_CHANGES"] = "false" }
it "prevents the replace" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/The list of sources changed/)
end
@ -216,7 +216,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile")
expect(err).to include("* rack-obama")
@ -254,7 +254,7 @@ RSpec.describe "install in deployment or frozen mode" do
bundle "config --local path .bundle"
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("The path `#{lib_path("path_gem-1.0")}` does not exist.")
end
@ -266,7 +266,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
ENV["BUNDLE_FROZEN"] = "1"
bundle "install"
bundle "install", :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile")
expect(err).to include("* rack-obama")
@ -282,7 +282,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
ENV["BUNDLE_DEPLOYMENT"] = "true"
bundle "install"
bundle "install", :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile")
expect(err).to include("* rack-obama")
@ -325,7 +325,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* activesupport\n\n")
expect(err).to include("You have deleted from the Gemfile:\n* rack")
@ -339,7 +339,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have added to the Gemfile:\n* source: git://hubz.com (at master)")
expect(err).not_to include("You have changed in the Gemfile")
@ -359,7 +359,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have deleted from the Gemfile:\n* source: #{lib_path("rack-1.0")} (at master@#{revision_for(lib_path("rack-1.0"))[0..6]}")
expect(err).not_to include("You have added to the Gemfile")
@ -383,7 +383,7 @@ RSpec.describe "install in deployment or frozen mode" do
G
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("deployment mode")
expect(err).to include("You have changed in the Gemfile:\n* rack from `no specified source` to `#{lib_path("rack")} (at master@#{revision_for(lib_path("rack"))[0..6]})`")
expect(err).not_to include("You have added to the Gemfile")

View file

@ -14,7 +14,7 @@ RSpec.describe "bundle install" do
end
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rails"
G
@ -40,7 +40,7 @@ In Gemfile:
RUBY
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rails"
gem "activesupport", :git => "#{lib_path("activesupport")}"
@ -68,7 +68,7 @@ In Gemfile:
RUBY
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rails"
@ -105,7 +105,7 @@ In Gemfile:
build_gem "a"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo4)}"
source "#{file_uri_for(gem_repo2)}" do
gem "rails"
@ -132,7 +132,7 @@ In Gemfile:
end
it "removes the downloaded .gem" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo4)}"
gem "a"
G

View file

@ -61,7 +61,7 @@ RSpec.describe "bundle install from an existing gemspec" do
it "should raise if there are no gemspecs available" do
build_lib("foo", :path => tmp.join("foo"), :gemspec => false)
install_gemfile(<<-G)
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
G
@ -73,7 +73,7 @@ RSpec.describe "bundle install from an existing gemspec" do
s.write("foo2.gemspec", build_spec("foo", "4.0").first.to_ruby)
end
install_gemfile(<<-G)
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gemspec :path => '#{tmp.join("foo")}'
G
@ -189,7 +189,7 @@ RSpec.describe "bundle install from an existing gemspec" do
s.write "raise 'ahh' unless Dir.pwd == '#{tmp.join("foo")}'"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gemspec :path => '#{tmp.join("foo")}'
G
expect(last_command.stdboth).not_to include("ahh")
@ -292,7 +292,7 @@ RSpec.describe "bundle install from an existing gemspec" do
end
bundle "config --local deployment true"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("changed")
end

View file

@ -79,7 +79,7 @@ RSpec.describe "bundle install with git sources" do
it "complains if pinned specs don't exist in the git repo" do
build_git "foo"
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem "foo", "1.1", :git => "#{lib_path("foo-1.0")}"
G
@ -93,7 +93,7 @@ RSpec.describe "bundle install with git sources" do
s.platform = "java"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
platforms :jruby do
gem "only_java", "1.2", :git => "#{lib_path("only_java-1.0-java")}"
end
@ -114,7 +114,7 @@ RSpec.describe "bundle install with git sources" do
s.write "only_java1-0.gemspec", File.read("#{lib_path("only_java-1.0-java")}/only_java.gemspec")
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
platforms :jruby do
gem "only_java", "1.2", :git => "#{lib_path("only_java-1.1-java")}"
end
@ -510,7 +510,7 @@ RSpec.describe "bundle install with git sources" do
G
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
solution = "config unset local.rack"
@ -532,7 +532,7 @@ RSpec.describe "bundle install with git sources" do
G
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/Cannot use local override for rack-0.8 at #{Regexp.escape(lib_path('local-rack').to_s)} because :branch is not specified in Gemfile/)
solution = "config unset local.rack"
@ -574,7 +574,7 @@ RSpec.describe "bundle install with git sources" do
G
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/is using branch another but Gemfile specifies master/)
end
@ -591,7 +591,7 @@ RSpec.describe "bundle install with git sources" do
G
bundle %(config set local.rack #{lib_path("local-rack")})
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/The Gemfile lock is pointing to revision \w+/)
end
end
@ -789,7 +789,7 @@ RSpec.describe "bundle install with git sources" do
gem "foo", "1.0", :git => "omgomg"
G
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("Git error:")
expect(err).to include("fatal")
@ -837,7 +837,7 @@ RSpec.describe "bundle install with git sources" do
sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
git "#{lib_path("has_submodule-1.0")}" do
gem "has_submodule"
end
@ -923,7 +923,7 @@ RSpec.describe "bundle install with git sources" do
FileUtils.mkdir_p(default_bundle_path)
FileUtils.touch(default_bundle_path("bundler"))
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@ -1027,7 +1027,7 @@ RSpec.describe "bundle install with git sources" do
G
expect(out).to_not match(/Revision.*does not exist/)
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem "foo", :git => "#{file_uri_for(lib_path("foo-1.0"))}", :ref => "deadbeef"
G
expect(err).to include("Revision deadbeef does not exist in the repository")
@ -1103,8 +1103,7 @@ RSpec.describe "bundle install with git sources" do
H
end
bundle :install,
:requires => [lib_path("install_hooks.rb")]
bundle :install, :requires => [lib_path("install_hooks.rb")], :raise_on_error => false
expect(err).to include("failed for foo-1.0")
end
end
@ -1189,7 +1188,7 @@ RSpec.describe "bundle install with git sources" do
RUBY
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "foo", :git => "#{lib_path("foo-1.0")}"
G
@ -1376,7 +1375,7 @@ In Gemfile:
G
with_path_as("") do
bundle "update", :all => true
bundle "update", :all => true, :raise_on_error => false
end
expect(err).
to include("You need to install git to be able to use gems from git repositories. For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git")
@ -1429,7 +1428,7 @@ In Gemfile:
let(:credentials) { "user1:password1" }
it "does not display the password" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
git "https://#{credentials}@github.com/company/private-repo" do
gem "foo"
end
@ -1444,7 +1443,7 @@ In Gemfile:
let(:credentials) { "oauth_token" }
it "displays the oauth scheme but not the oauth token" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
git "https://#{credentials}:x-oauth-basic@github.com/company/private-repo" do
gem "foo"
end

View file

@ -205,12 +205,12 @@ RSpec.describe "bundle install with groups" do
it "removes groups from with when passed at --without", :bundler => "< 3" do
bundle "config --local with debugging"
bundle "install --without debugging"
bundle "install --without debugging", :raise_on_error => false
expect(the_bundle).not_to include_gem "thin 1.0"
end
it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do
bundle "install --with emo debugging --without emo"
bundle "install --with emo debugging --without emo", :raise_on_error => false
expect(last_command).to be_failure
expect(err).to include("The offending groups are: emo")
end

View file

@ -65,7 +65,7 @@ RSpec.describe "bundle install with explicit source paths" do
username = "some_unexisting_user"
relative_path = lib_path("foo-1.0").relative_path_from(Pathname.new("/home/#{username}").expand_path)
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem 'foo', :path => "~#{username}/#{relative_path}"
G
expect(err).to match("There was an error while trying to use the path `~#{username}/#{relative_path}`.")
@ -223,7 +223,7 @@ RSpec.describe "bundle install with explicit source paths" do
G
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem "foo", :path => "#{lib_path("foo-1.0")}"
G
@ -306,7 +306,7 @@ RSpec.describe "bundle install with explicit source paths" do
s.write "bar.gemspec", build_spec("bar", "1.0").first.to_ruby
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gemspec :path => "#{lib_path("foo")}"
G
@ -709,8 +709,7 @@ RSpec.describe "bundle install with explicit source paths" do
H
end
bundle :install,
:requires => [lib_path("install_hooks.rb")]
bundle :install, :requires => [lib_path("install_hooks.rb")], :raise_on_error => false
expect(err).to include("failed for foo-1.0")
end

View file

@ -99,7 +99,7 @@ RSpec.describe "ruby requirement" do
end
it "fails gracefully with malformed requirements" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
ruby ">= 0", "-.\\0"
gem "rack"

View file

@ -36,7 +36,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "fails", :bundler => "3" do
bundle :install
bundle :instal, :raise_on_error => false
expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
@ -52,17 +52,17 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "rack-obama"
gem "rack", "1.0.0" # force it to install the working version in repo1
G
bundle :install
end
it "warns about ambiguous gems, but installs anyway", :bundler => "2" do
bundle :install
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).to include("Installed from: #{file_uri_for(gem_repo1)}")
expect(the_bundle).to include_gems("rack-obama 1.0.0", "rack 1.0.0", :source => "remote1")
end
it "fails", :bundler => "3" do
bundle :install, :raise_on_error => false
expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
@ -246,17 +246,17 @@ RSpec.describe "bundle install with gems on multiple sources" do
gem "depends_on_rack"
end
G
bundle :install
end
it "installs from the other source and warns about ambiguous gems", :bundler => "2" do
bundle :install
expect(err).to include("Warning: the gem 'rack' was found in multiple sources.")
expect(err).to include("Installed from: #{file_uri_for(gem_repo2)}")
expect(the_bundle).to include_gems("depends_on_rack 1.0.1", "rack 1.0.0")
end
it "fails", :bundler => "3" do
bundle :install, :raise_on_error => false
expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
@ -296,7 +296,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "fails", :bundler => "3" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("Each source after the first must include a block")
expect(exitstatus).to eq(4) if exitstatus
end
@ -356,7 +356,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "does not find the dependency" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("Could not find gem 'rack', which is required by gem 'depends_on_rack', in any of the relevant sources")
end
end
@ -396,7 +396,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
it "does not install the gem" do
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("Could not find gem 'not_in_repo1'")
end
end
@ -629,7 +629,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_gem "rack"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo4)}"
source "#{file_uri_for(gem_repo1)}" do
gem "thin"

View file

@ -3,7 +3,7 @@
RSpec.describe "bundle install" do
context "with duplicated gems" do
it "will display a warning" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
gem 'rails', '~> 4.0.0'
gem 'rails', '~> 4.0.0'
G
@ -57,7 +57,7 @@ RSpec.describe "bundle install" do
gem "rack", :lib => "rack"
G
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/You passed :lib as an option for gem 'rack', but it is invalid/)
end
end

View file

@ -21,7 +21,7 @@ RSpec.describe "compact index api" do
gem " sinatra"
G
bundle :install, :artifice => "compact_index"
bundle :install, :artifice => "compact_index", :raise_on_error => false
expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
@ -229,7 +229,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
bundle :install, :artifice => "compact_index_redirects"
bundle :install, :artifice => "compact_index_redirects", :raise_on_error => false
expect(err).to match(/Too many redirects/)
end
@ -617,7 +617,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
bundle :install, :artifice => "endpoint_500"
bundle :install, :artifice => "endpoint_500", :raise_on_error => false
expect(out).not_to include("#{user}:#{password}")
end
@ -691,14 +691,14 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "shows instructions if auth is not provided for the source" do
bundle :install, :artifice => "compact_index_strict_basic_authentication"
bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false
expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "compact_index_strict_basic_authentication"
bundle :install, :artifice => "compact_index_strict_basic_authentication", :raise_on_error => false
expect(err).to include("Bad username or password")
end
end
@ -737,7 +737,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }
bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, :raise_on_error => false
expect(err).to include("OpenSSL")
end
end
@ -757,7 +757,7 @@ The checksum of /versions does not match the checksum provided by the server! So
gem "rack"
G
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/could not verify the SSL certificate/i)
end
end
@ -856,7 +856,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "fails gracefully when the source URI has an invalid scheme" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "htps://rubygems.org"
gem "rack"
G
@ -868,7 +868,7 @@ The checksum of /versions does not match the checksum provided by the server! So
describe "checksum validation" do
it "raises when the checksum does not match" do
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum"
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :raise_on_error => false
source "#{source_uri}"
gem "rack"
G
@ -888,7 +888,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "raises when the checksum is the wrong length" do
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, :verbose => true
install_gemfile <<-G, :artifice => "compact_index_wrong_gem_checksum", :env => { "BUNDLER_SPEC_RACK_CHECKSUM" => "checksum!", "DEBUG" => "1" }, :verbose => true, :raise_on_error => false
source "#{source_uri}"
gem "rack"
G
@ -914,7 +914,7 @@ The checksum of /versions does not match the checksum provided by the server! So
end
it "doesn't explode when the API dependencies are wrong" do
install_gemfile <<-G, :artifice => "compact_index_wrong_dependencies", :env => { "DEBUG" => "true" }
install_gemfile <<-G, :artifice => "compact_index_wrong_dependencies", :env => { "DEBUG" => "true" }, :raise_on_error => false
source "#{source_uri}"
gem "rails"
G

View file

@ -21,7 +21,7 @@ RSpec.describe "gemcutter's dependency API" do
gem " sinatra"
G
bundle :install, :artifice => "endpoint"
bundle :install, :artifice => "endpoint", :raise_on_error => false
expect(err).to include("' sinatra' is not a valid gem name because it contains whitespace.")
end
@ -219,7 +219,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
bundle :install, :artifice => "endpoint_redirect"
bundle :install, :artifice => "endpoint_redirect", :raise_on_error => false
expect(err).to match(/Too many redirects/)
end
@ -591,7 +591,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
bundle :install, :artifice => "endpoint_500"
bundle :install, :artifice => "endpoint_500", :raise_on_error => false
expect(out).not_to include("#{user}:#{password}")
end
@ -665,14 +665,14 @@ RSpec.describe "gemcutter's dependency API" do
end
it "shows instructions if auth is not provided for the source" do
bundle :install, :artifice => "endpoint_strict_basic_authentication"
bundle :install, :artifice => "endpoint_strict_basic_authentication", :raise_on_error => false
expect(err).to include("bundle config set #{source_hostname} username:password")
end
it "fails if authentication has already been provided, but failed" do
bundle "config set #{source_hostname} #{user}:wrong"
bundle :install, :artifice => "endpoint_strict_basic_authentication"
bundle :install, :artifice => "endpoint_strict_basic_authentication", :raise_on_error => false
expect(err).to include("Bad username or password")
end
end
@ -711,7 +711,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }
bundle :install, :env => { "RUBYOPT" => opt_add("-I#{bundled_app("broken_ssl")}", ENV["RUBYOPT"]) }, :raise_on_error => false
expect(err).to include("OpenSSL")
end
end
@ -731,7 +731,7 @@ RSpec.describe "gemcutter's dependency API" do
gem "rack"
G
bundle :install
bundle :install, :raise_on_error => false
expect(err).to match(/could not verify the SSL certificate/i)
end
end

View file

@ -184,8 +184,8 @@ RSpec.describe "bundle flex_install" do
end
it "does not install gems whose dependencies are not met" do
bundle :install
ruby <<-RUBY
bundle :install, :raise_on_error => false
ruby <<-RUBY, :raise_on_error => false
require 'bundler/setup'
RUBY
expect(err).to match(/could not find gem 'rack-obama/i)
@ -210,7 +210,7 @@ RSpec.describe "bundle flex_install" do
the gems in your Gemfile, which may resolve the conflict.
E
bundle :install, :retry => 0
bundle :install, :retry => 0, :raise_on_error => false
expect(err).to end_with(nice_error)
end
end
@ -232,7 +232,7 @@ RSpec.describe "bundle flex_install" do
it "does something" do
expect do
bundle "install"
bundle "install", :raise_on_error => false
end.not_to change { File.read(bundled_app_lock) }
expect(err).to include("rack = 0.9.1")
@ -341,7 +341,7 @@ RSpec.describe "bundle flex_install" do
G
# upgrade Rails to 3.0.0 and then install again
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem "rails", "3.0.0"
gem "capybara", "0.3.9"

View file

@ -207,7 +207,7 @@ RSpec.describe "bundle install with install-time dependencies" do
it "raises an error during resolution" do
skip "ruby requirement includes platform and it shouldn't" if Gem.win_platform?
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :raise_on_error => false
source "http://localgemserver.test/"
ruby #{ruby_requirement}
gem 'require_ruby'
@ -256,7 +256,7 @@ RSpec.describe "bundle install with install-time dependencies" do
end
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo2)}"
gem 'require_rubygems'
G

View file

@ -106,7 +106,7 @@ RSpec.shared_examples "bundle install --standalone" do
G
end
bundle "config --local path #{bundled_app("bundle")}"
install_gemfile <<-G, :standalone => true, :dir => cwd
install_gemfile <<-G, :standalone => true, :dir => cwd, :raise_on_error => false
gem "bar", :git => "#{lib_path("bar-1.0")}"
G
end

View file

@ -109,7 +109,7 @@ RSpec.describe "bundle install" do
s.required_ruby_version = "#{RUBY_VERSION}.#{RUBY_PATCHLEVEL}"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{RUBY_PATCHLEVEL}'
gemspec
G
@ -123,7 +123,7 @@ RSpec.describe "bundle install" do
s.required_ruby_version = "#{RUBY_VERSION}.#{patchlevel}"
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
ruby '#{RUBY_VERSION}', :engine_version => '#{RUBY_VERSION}', :engine => 'ruby', :patchlevel => '#{patchlevel}'
gemspec
G
@ -140,7 +140,7 @@ RSpec.describe "bundle install" do
s.required_ruby_version = version
end
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
ruby '#{version}', :engine_version => '#{version}', :engine => 'ruby'
gemspec
G

View file

@ -111,7 +111,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
expect(err).to include("Internal Server Error 500")
# rack 1.0.0 is not installed and rack 0.9.1 is not
expect(the_bundle).not_to include_gems "rack 1.0.0"
@ -124,7 +124,7 @@ RSpec.describe "global gem caching" do
expect(source_global_cache("rack-1.0.0.gem")).to exist
expect(source2_global_cache("rack-0.9.1.gem")).to exist
bundle :install, :artifice => "compact_index_no_gem"
bundle :install, :artifice => "compact_index_no_gem", :raise_on_error => false
expect(err).to include("Internal Server Error 500")
# rack 0.9.1 is not installed and rack 1.0.0 is not
expect(the_bundle).not_to include_gems "rack 0.9.1"

View file

@ -37,7 +37,7 @@ RSpec.describe "bundle install" do
end
it "disallows --path vendor/bundle --system", :bundler => "< 3" do
bundle "install --path vendor/bundle --system"
bundle "install --path vendor/bundle --system", :raise_on_error => false
expect(err).to include("Please choose only one option.")
expect(exitstatus).to eq(15) if exitstatus
end
@ -187,7 +187,7 @@ RSpec.describe "bundle install" do
vendored_gems("extensions").rmtree
run "require 'very_simple_binary_c'"
run "require 'very_simple_binary_c'", :raise_on_error => false
expect(err).to include("Bundler::GemNotFound")
bundle "config --local path ./vendor/bundle"
@ -211,7 +211,7 @@ RSpec.describe "bundle install" do
G
bundle "config --local path bundle"
bundle :install
bundle :install, :raise_on_error => false
expect(err).to include("file already exists")
end
end

View file

@ -16,24 +16,24 @@ RSpec.describe "policies with unsigned gems" do
end
it "will work after you try to deploy without a lock" do
bundle "install --deployment"
bundle "install --deployment", :raise_on_error => false
bundle :install
expect(exitstatus).to eq(0) if exitstatus
expect(the_bundle).to include_gems "rack 1.0", "signed_gem 1.0"
end
it "will fail when given invalid security policy" do
bundle "install --trust-policy=InvalidPolicyName"
bundle "install --trust-policy=InvalidPolicyName", :raise_on_error => false
expect(err).to include("RubyGems doesn't know about trust policy")
end
it "will fail with High Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=HighSecurity"
bundle "install --trust-policy=HighSecurity", :raise_on_error => false
expect(err).to include("security policy didn't allow")
end
it "will fail with Medium Security setting due to presence of unsigned gem" do
bundle "install --trust-policy=MediumSecurity"
bundle "install --trust-policy=MediumSecurity", :raise_on_error => false
expect(err).to include("security policy didn't allow")
end
@ -53,12 +53,12 @@ RSpec.describe "policies with signed gems and no CA" do
end
it "will fail with High Security setting, gem is self-signed" do
bundle "install --trust-policy=HighSecurity"
bundle "install --trust-policy=HighSecurity", :raise_on_error => false
expect(err).to include("security policy didn't allow")
end
it "will fail with Medium Security setting, gem is self-signed" do
bundle "install --trust-policy=MediumSecurity"
bundle "install --trust-policy=MediumSecurity", :raise_on_error => false
expect(err).to include("security policy didn't allow")
end

View file

@ -22,7 +22,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do
L
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo4)}"
gem "foo", "10.0.0"
G
@ -33,7 +33,7 @@ RSpec.context "when installing a bundle that includes yanked gems" do
it "throws the original error when only the Gemfile specifies a gem version that doesn't exist" do
bundle "config set force_ruby_platform true"
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo4)}"
gem "foo", "10.0.0"
G
@ -63,7 +63,7 @@ RSpec.context "when using gem before installing" do
rack (= 0.9.1)
L
bundle :list
bundle :list, :raise_on_error => false
expect(err).to include("Could not find rack-0.9.1 in any of the sources")
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.")

View file

@ -1207,7 +1207,7 @@ RSpec.describe "the lockfile format" do
end
it "raises if two different versions are used" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}/"
gem "rack", "1.0"
gem "rack", "1.1"
@ -1218,7 +1218,7 @@ RSpec.describe "the lockfile format" do
end
it "raises if two different sources are used" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}/"
gem "rack"
gem "rack", :git => "git://hubz.com"
@ -1369,7 +1369,7 @@ RSpec.describe "the lockfile format" do
rack_middleware
L
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rack_middleware"
G
@ -1467,7 +1467,7 @@ RSpec.describe "the lockfile format" do
#{Bundler::VERSION}
L
install_gemfile(<<-G)
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}/"
gem "rack"
G

View file

@ -2,19 +2,19 @@
RSpec.describe "bundle command names" do
it "work when given fully" do
bundle "install"
bundle "install", :raise_on_error => false
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "work when not ambiguous" do
bundle "ins"
bundle "ins", :raise_on_error => false
expect(err).to eq("Could not locate Gemfile")
expect(last_command.stdboth).not_to include("Ambiguous command")
end
it "print a friendly error when ambiguous" do
bundle "in"
bundle "in", :raise_on_error => false
expect(err).to eq("Ambiguous command in matches [info, init, inject, install]")
end
end

View file

@ -55,7 +55,7 @@ RSpec.describe "Gem::SourceIndex#refresh!" do
end
it "does not explode when called" do
run "Gem.source_index.refresh!"
run "Gem::SourceIndex.new([]).refresh!"
run "Gem.source_index.refresh!", :raise_on_error => false
run "Gem::SourceIndex.new([]).refresh!", :raise_on_error => false
end
end

View file

@ -94,7 +94,7 @@ RSpec.describe "major deprecations" do
describe "bundle update --quiet" do
it "does not print any deprecations" do
bundle :update, :quiet => true
bundle :update, :quiet => true, :raise_on_error => false
expect(deprecations).to be_empty
end
end
@ -106,7 +106,7 @@ RSpec.describe "major deprecations" do
gem "rack"
G
bundle "check --path vendor/bundle"
bundle "check --path vendor/bundle", :raise_on_error => false
end
it "should print a deprecation warning", :bundler => "2" do
@ -128,7 +128,7 @@ RSpec.describe "major deprecations" do
gem "rack"
G
bundle "check --path=vendor/bundle"
bundle "check --path=vendor/bundle", :raise_on_error => false
end
it "should print a deprecation warning", :bundler => "2" do
@ -563,7 +563,7 @@ The :gist git source is deprecated, and will be removed in the future. Add this
context "bundle console" do
before do
bundle "console"
bundle "console", :raise_on_error => false
end
it "prints a deprecation warning", :bundler => "2" do

View file

@ -168,7 +168,7 @@ G
gem "foo"
G
bundle "platform"
bundle "platform", :raise_on_error => false
expect(exitstatus).not_to eq(0) if exitstatus
end
@ -181,7 +181,7 @@ G
gem "foo"
G
bundle "platform"
bundle "platform", :raise_on_error => false
expect(exitstatus).not_to eq(0) if exitstatus
end
@ -194,7 +194,7 @@ G
gem "foo"
G
bundle "platform"
bundle "platform", :raise_on_error => false
expect(exitstatus).not_to eq(0) if exitstatus
end
@ -324,7 +324,7 @@ G
end
it "doesn't install when the ruby version doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@ -336,7 +336,7 @@ G
end
it "doesn't install when engine doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@ -348,7 +348,7 @@ G
end
it "doesn't install when engine version doesn't match", :jruby do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@ -360,7 +360,7 @@ G
end
it "doesn't install when patchlevel doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "rack"
@ -422,7 +422,7 @@ G
#{ruby_version_incorrect}
G
bundle :check
bundle :check, :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -439,7 +439,7 @@ G
#{engine_incorrect}
G
bundle :check
bundle :check, :raise_on_error => false
should_be_engine_incorrect
end
@ -456,7 +456,7 @@ G
#{engine_version_incorrect}
G
bundle :check
bundle :check, :raise_on_error => false
should_be_engine_version_incorrect
end
@ -473,7 +473,7 @@ G
#{patchlevel_incorrect}
G
bundle :check
bundle :check, :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -533,7 +533,7 @@ G
build_gem "activesupport", "3.0"
end
bundle :update, :all => true
bundle :update, :all => true, :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -549,7 +549,7 @@ G
build_gem "activesupport", "3.0"
end
bundle :update, :all => true
bundle :update, :all => true, :raise_on_error => false
should_be_engine_incorrect
end
@ -565,7 +565,7 @@ G
build_gem "activesupport", "3.0"
end
bundle :update, :all => true
bundle :update, :all => true, :raise_on_error => false
should_be_engine_version_incorrect
end
@ -580,7 +580,7 @@ G
build_gem "activesupport", "3.0"
end
bundle :update, :all => true
bundle :update, :all => true, :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -625,7 +625,7 @@ G
#{ruby_version_incorrect}
G
bundle "show rails"
bundle "show rails", :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -637,7 +637,7 @@ G
#{engine_incorrect}
G
bundle "show rails"
bundle "show rails", :raise_on_error => false
should_be_engine_incorrect
end
@ -649,7 +649,7 @@ G
#{engine_version_incorrect}
G
bundle "show rails"
bundle "show rails", :raise_on_error => false
should_be_engine_version_incorrect
end
@ -664,7 +664,7 @@ G
build_gem "activesupport", "3.0"
end
bundle "show rails"
bundle "show rails", :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -707,7 +707,7 @@ G
#{ruby_version_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -718,7 +718,7 @@ G
#{engine_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_engine_incorrect
end
@ -729,7 +729,7 @@ G
#{engine_version_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_engine_version_incorrect
end
@ -741,7 +741,7 @@ G
#{patchlevel_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -784,7 +784,7 @@ G
#{ruby_version_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -795,7 +795,7 @@ G
#{engine_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_engine_incorrect
end
@ -806,7 +806,7 @@ G
#{engine_version_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_engine_version_incorrect
end
@ -818,7 +818,7 @@ G
#{patchlevel_incorrect}
G
bundle :cache
bundle :cache, :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -859,7 +859,7 @@ G
#{ruby_version_incorrect}
G
bundle "exec rackup"
bundle "exec rackup", :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -870,7 +870,7 @@ G
#{engine_incorrect}
G
bundle "exec rackup"
bundle "exec rackup", :raise_on_error => false
should_be_engine_incorrect
end
@ -893,7 +893,7 @@ G
#{patchlevel_incorrect}
G
bundle "exec rackup"
bundle "exec rackup", :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -952,7 +952,7 @@ G
#{ruby_version_incorrect}
G
bundle "console"
bundle "console", :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -966,7 +966,7 @@ G
#{engine_incorrect}
G
bundle "console"
bundle "console", :raise_on_error => false
should_be_engine_incorrect
end
@ -980,7 +980,7 @@ G
#{engine_version_incorrect}
G
bundle "console"
bundle "console", :raise_on_error => false
should_be_engine_version_incorrect
end
@ -994,7 +994,7 @@ G
#{patchlevel_incorrect}
G
bundle "console"
bundle "console", :raise_on_error => false
should_be_patchlevel_incorrect
end
end
@ -1041,7 +1041,7 @@ G
end
it "fails when ruby version doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "yard"
gem "rack"
@ -1051,14 +1051,14 @@ G
FileUtils.rm(bundled_app_lock)
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false
expect(bundled_app_lock).not_to exist
should_be_ruby_version_incorrect
end
it "fails when engine doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "yard"
gem "rack"
@ -1068,14 +1068,14 @@ G
FileUtils.rm(bundled_app_lock)
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false
expect(bundled_app_lock).not_to exist
should_be_engine_incorrect
end
it "fails when engine version doesn't match", :jruby do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "yard"
gem "rack"
@ -1085,14 +1085,14 @@ G
FileUtils.rm(bundled_app_lock)
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false
expect(bundled_app_lock).not_to exist
should_be_engine_version_incorrect
end
it "fails when patchlevel doesn't match" do
install_gemfile <<-G
install_gemfile <<-G, :raise_on_error => false
source "#{file_uri_for(gem_repo1)}"
gem "yard"
gem "rack"
@ -1102,7 +1102,7 @@ G
FileUtils.rm(bundled_app_lock)
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }
ruby "require 'bundler/setup'", :env => { "BUNDLER_VERSION" => Bundler::VERSION }, :raise_on_error => false
expect(bundled_app_lock).not_to exist
should_be_patchlevel_incorrect
@ -1136,7 +1136,7 @@ G
#{ruby_version_correct}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
Gem Current Latest Requested Groups
@ -1162,7 +1162,7 @@ G
#{ruby_version_correct_engineless}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
expected_output = <<~TABLE.gsub("x", "\\\h").tr(".", "\.").strip
Gem Current Latest Requested Groups
@ -1187,7 +1187,7 @@ G
#{ruby_version_incorrect}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
should_be_ruby_version_incorrect
end
@ -1205,7 +1205,7 @@ G
#{engine_incorrect}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
should_be_engine_incorrect
end
@ -1223,7 +1223,7 @@ G
#{engine_version_incorrect}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
should_be_engine_version_incorrect
end
@ -1241,7 +1241,7 @@ G
#{patchlevel_incorrect}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
should_be_patchlevel_incorrect
end
@ -1259,7 +1259,7 @@ G
#{patchlevel_fixnum}
G
bundle "outdated"
bundle "outdated", :raise_on_error => false
should_be_patchlevel_fixnum
end
end

View file

@ -9,7 +9,7 @@ RSpec.describe "bundler plugin install" do
end
it "shows proper message when gem in not found in the source" do
bundle "plugin install no-foo --source #{file_uri_for(gem_repo1)}"
bundle "plugin install no-foo --source #{file_uri_for(gem_repo1)}", :raise_on_error => false
expect(err).to include("Could not find")
plugin_should_not_be_installed("no-foo")
@ -147,7 +147,7 @@ RSpec.describe "bundler plugin install" do
end
it "raises an error when both git and local git sources are specified" do
bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project"
bundle "plugin install foo --local_git /phony/path/project --git git@gitphony.com:/repo/project", :raise_on_error => false
expect(exitstatus).not_to eq(0) if exitstatus
expect(err).to eq("Remote and local plugin git sources can't be both specified")

View file

@ -337,7 +337,7 @@ RSpec.describe "real world edgecases", :realworld => true, :sometimes => true do
end
it "outputs a helpful error message when gems have invalid gemspecs" do
install_gemfile <<-G, :standalone => true
install_gemfile <<-G, :standalone => true, :raise_on_error => false
source 'https://rubygems.org'
gem "resque-scheduler", "2.2.0"
gem "redis-namespace", "1.6.0" # for a consistent resolution including ruby 2.3.0

View file

@ -71,7 +71,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
gem 'weakling'
G
bundle :install, :artifice => nil
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")
@ -86,7 +86,7 @@ RSpec.describe "fetching dependencies with a not available mirror", :realworld =
gem 'weakling'
G
bundle :install, :artifice => nil
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include "Fetching source index from #{mirror}/"
expect(err).to include <<-EOS.strip
@ -109,7 +109,7 @@ Could not fetch specs from #{mirror}/
gem 'weakling'
G
bundle :install, :artifice => nil
bundle :install, :artifice => nil, :raise_on_error => false
expect(out).to include("Fetching source index from #{mirror}")
expect(err).to include("Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from #{mirror}")

View file

@ -59,7 +59,7 @@ RSpec.describe "bundler/inline#gemfile" do
expect(out).to eq("two")
expect(exitstatus).to be_zero if exitstatus
script <<-RUBY
script <<-RUBY, :raise_on_error => false
gemfile do
path "#{lib_path}" do
gem "eleven"
@ -130,7 +130,7 @@ RSpec.describe "bundler/inline#gemfile" do
end
it "raises an exception if passed unknown arguments" do
script <<-RUBY
script <<-RUBY, :raise_on_error => false
gemfile(true, :arglebargle => true) do
path "#{lib_path}"
gem "two"

View file

@ -135,7 +135,7 @@ RSpec.describe "Bundler.require" do
end
G
run "Bundler.require"
run "Bundler.require", :raise_on_error => false
expect(err).to match("error while trying to load the gem 'faulty'")
expect(err).to match("Gem Internal Error Message")
end

View file

@ -90,7 +90,7 @@ RSpec.describe "Bundler.setup" do
end
it "handles multiple non-additive invocations" do
ruby <<-RUBY
ruby <<-RUBY, :raise_on_error => false
require '#{lib_dir}/bundler'
Bundler.setup(:default, :test)
Bundler.setup(:default)
@ -212,7 +212,7 @@ RSpec.describe "Bundler.setup" do
gem "rack"
G
ruby <<-R
ruby <<-R, :raise_on_error => false
require '#{lib_dir}/bundler'
Bundler.setup
@ -235,7 +235,7 @@ RSpec.describe "Bundler.setup" do
gem "nosuchgem", "10.0"
G
ruby <<-R
ruby <<-R, :raise_on_error => false
require '#{lib_dir}/bundler'
Bundler.setup
@ -434,7 +434,7 @@ RSpec.describe "Bundler.setup" do
end
it "provides a useful exception when the git repo is not checked out yet" do
run "1"
run "1", :raise_on_error => false
expect(err).to match(/the git source #{lib_path('rack-1.0.0')} is not yet checked out. Please run `bundle install`/i)
end
@ -475,7 +475,7 @@ RSpec.describe "Bundler.setup" do
end
R
run "puts 'FAIL'"
run "puts 'FAIL'", :raise_on_error => false
expect(err).not_to include "This is not the git you are looking for"
end
@ -521,7 +521,7 @@ RSpec.describe "Bundler.setup" do
bundle! :install
FileUtils.rm_rf(lib_path("local-rack"))
run "require 'rack'"
run "require 'rack'", :raise_on_error => false
expect(err).to match(/Cannot use local override for rack-0.8 because #{Regexp.escape(lib_path('local-rack').to_s)} does not exist/)
end
@ -543,7 +543,7 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}"
G
run "require 'rack'"
run "require 'rack'", :raise_on_error => false
expect(err).to match(/because :branch is not specified in Gemfile/)
end
@ -565,7 +565,7 @@ RSpec.describe "Bundler.setup" do
gem "rack", :git => "#{lib_path("rack-0.8")}", :branch => "changed"
G
run "require 'rack'"
run "require 'rack'", :raise_on_error => false
expect(err).to match(/is using branch master but Gemfile specifies changed/)
end
@ -585,7 +585,7 @@ RSpec.describe "Bundler.setup" do
G
bundle %(config set local.rack #{lib_path("local-rack")})
run "require 'rack'"
run "require 'rack'", :raise_on_error => false
expect(err).to match(/is using branch master but Gemfile specifies nonexistant/)
end
end
@ -1022,7 +1022,7 @@ end
ref = update_git "bar", :gemspec => false do |s|
s.write "bar.gemspec", "require 'foobarbaz'"
end.ref_for("HEAD")
bundle :install
bundle :install, :raise_on_error => false
expect(err.lines.map(&:chomp)).to include(
a_string_starting_with("[!] There was an error while loading `bar.gemspec`:"),
@ -1374,7 +1374,7 @@ end
gem "rack"
G
ruby <<-RUBY
ruby <<-RUBY, :raise_on_error => false
require "#{lib_dir}/bundler/setup"
Object.new.gem "rack"
puts "FAIL"
@ -1390,7 +1390,7 @@ end
gem "rack"
G
ruby <<-RUBY
ruby <<-RUBY, :raise_on_error => false
require "#{lib_dir}/bundler/setup"
Object.new.require "rack"
puts "FAIL"

View file

@ -721,7 +721,7 @@ module Spec
end
super(options.merge(:path => libpath, :gemspec => update_gemspec, :source => source))
@context.git("add *", libpath)
@context.git("commit -m BUMP", libpath)
@context.git("commit -m BUMP", libpath, :raise_on_error => false)
end
end

View file

@ -25,11 +25,7 @@ module Spec
def self.bang(method)
define_method("#{method}!") do |*args, &blk|
send(method, *args, &blk).tap do
unless last_command.success?
raise "Invoking #{method}!(#{args.map(&:inspect).join(", ")}) failed:\n#{last_command.stdboth}"
end
end
send(method, *args, &blk)
end
end
@ -110,6 +106,7 @@ module Spec
load_path << spec_dir
dir = options.delete(:dir) || bundled_app
raise_on_error = options.delete(:raise_on_error)
args = options.map do |k, v|
case v
@ -126,7 +123,7 @@ module Spec
ruby_cmd = build_ruby_cmd({ :sudo => sudo, :load_path => load_path, :requires => requires })
cmd = "#{ruby_cmd} #{bundle_bin} #{cmd}#{args}"
sys_exec(cmd, { :env => env, :dir => dir }, &block)
sys_exec(cmd, { :env => env, :dir => dir, :raise_on_error => raise_on_error }, &block)
end
bang :bundle
@ -182,8 +179,8 @@ module Spec
"#{Gem.ruby} -S #{ENV["GEM_PATH"]}/bin/rake"
end
def git(cmd, path)
sys_exec("git #{cmd}", :dir => path)
def git(cmd, path, options = {})
sys_exec("git #{cmd}", options.merge(:dir => path))
end
def sys_exec(cmd, options = {})
@ -207,6 +204,10 @@ module Spec
(@command_executions ||= []) << command_execution
unless options[:raise_on_error] == false || command_execution.success?
raise "Invoking #{cmd} failed!"
end
command_execution.stdout
end
bang :sys_exec

View file

@ -116,20 +116,17 @@ module Spec
source = opts.delete(:source)
groups = Array(opts[:groups])
exclude_from_load_path = opts.delete(:exclude_from_load_path)
opts[:raise_on_error] = false
groups << opts
@errors = names.map do |name|
name, version, platform = name.split(/\s+/)
require_path = name == "bundler" ? "#{lib_dir}/bundler" : name.tr("-", "/")
version_const = name == "bundler" ? "Bundler::VERSION" : Spec::Builders.constantize(name)
begin
code = []
code << "$LOAD_PATH.delete '#{exclude_from_load_path}'" if exclude_from_load_path
code << "require '#{require_path}.rb'"
code << "puts #{version_const}"
run! code.join("; "), *groups
rescue StandardError => e
next "#{name} is not installed:\n#{indent(e)}"
end
code = []
code << "$LOAD_PATH.delete '#{exclude_from_load_path}'" if exclude_from_load_path
code << "require '#{require_path}.rb'"
code << "puts #{version_const}"
run code.join("; "), *groups
actual_version, actual_platform = out.strip.split(/\s+/, 2)
unless Gem::Version.new(actual_version) == Gem::Version.new(version)
next "#{name} was expected to be at version #{version} but was #{actual_version}"
@ -138,12 +135,8 @@ module Spec
next "#{name} was expected to be of platform #{platform} but was #{actual_platform}"
end
next unless source
begin
source_const = "#{Spec::Builders.constantize(name)}_SOURCE"
run! "require '#{require_path}/source'; puts #{source_const}", *groups
rescue StandardError
next "#{name} does not have a source defined:\n#{indent(e)}"
end
source_const = "#{Spec::Builders.constantize(name)}_SOURCE"
run "require '#{require_path}/source'; puts #{source_const}", *groups
unless out.strip == source
next "Expected #{name} (#{version}) to be installed from `#{source}`, was actually from `#{out}`"
end
@ -155,20 +148,17 @@ module Spec
match_when_negated do
opts = names.last.is_a?(Hash) ? names.pop : {}
groups = Array(opts[:groups]) || []
opts[:raise_on_error] = false
@errors = names.map do |name|
name, version = name.split(/\s+/, 2)
begin
run <<-R, *(groups + [opts])
begin
require '#{name}'
puts #{Spec::Builders.constantize(name)}
rescue LoadError, NameError
puts "WIN"
end
R
rescue StandardError => e
next "checking for #{name} failed:\n#{e}\n#{e.backtrace.join("\n")}"
end
run <<-R, *(groups + [opts])
begin
require '#{name}'
puts #{Spec::Builders.constantize(name)}
rescue LoadError, NameError
puts "WIN"
end
R
next if out == "WIN"
next "expected #{name} to not be installed, but it was" if version.nil?
if Gem::Version.new(out) == Gem::Version.new(version)

View file

@ -189,7 +189,7 @@ RSpec.describe "bundle update" do
lib_path("foo-1.0").join(".git").rmtree
bundle :update, :all => true
bundle :update, :all => true, :raise_on_error => false
expect(err).to include(lib_path("foo-1.0").to_s).
and match(/Git error: command `git fetch.+has failed/)
end