summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler_spec.rb39
-rw-r--r--spec/cache/git_spec.rb2
-rw-r--r--spec/commands/binstubs_spec.rb6
-rw-r--r--spec/commands/check_spec.rb14
-rw-r--r--spec/commands/clean_spec.rb26
-rw-r--r--spec/commands/exec_spec.rb13
-rw-r--r--spec/commands/install_spec.rb2
-rw-r--r--spec/commands/lock_spec.rb2
-rw-r--r--spec/commands/open_spec.rb8
-rw-r--r--spec/commands/package_spec.rb2
-rw-r--r--spec/commands/show_spec.rb2
-rw-r--r--spec/commands/update_spec.rb2
-rw-r--r--spec/install/bundler_spec.rb4
-rw-r--r--spec/install/gemfile/git_spec.rb6
-rw-r--r--spec/install/gemfile/groups_spec.rb8
-rw-r--r--spec/install/gemfile/path_spec.rb6
-rw-r--r--spec/install/gemspecs_spec.rb4
-rw-r--r--spec/other/cli_dispatch_spec.rb8
-rw-r--r--spec/realworld/edgecases_spec.rb4
-rw-r--r--spec/runtime/require_spec.rb18
-rw-r--r--spec/runtime/setup_spec.rb26
-rw-r--r--spec/support/matchers.rb12
-rw-r--r--spec/update/git_spec.rb2
23 files changed, 134 insertions, 82 deletions
diff --git a/spec/bundler/bundler_spec.rb b/spec/bundler/bundler_spec.rb
index 8f0b26aa0d..83db582c0a 100644
--- a/spec/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler_spec.rb
@@ -5,6 +5,45 @@ require "bundler"
describe Bundler do
describe "version 1.99" do
+ context "when bundle is run" do
+ it "should print a single deprecation warning" do
+ # install_gemfile calls `bundle :install, opts`
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+
+ expect(out).to include("DEPRECATION: Gemfile and Gemfile.lock are " \
+ "deprecated and will be replaced with gems.rb and gems.locked in " \
+ "Bundler 2.0.0.")
+ expect(err).to lack_errors
+ end
+ end
+
+ context "when Bundler.setup is run in a ruby script" do
+ it "should print a single deprecation warning" do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack", :group => :test
+ G
+
+ ruby <<-RUBY
+ require 'rubygems'
+ require 'bundler'
+ require 'bundler/vendored_thor'
+
+ Bundler.ui = Bundler::UI::Shell.new
+ Bundler.setup
+ Bundler.setup
+ RUBY
+
+ expect(out).to eq("DEPRECATION: Gemfile and Gemfile.lock are " \
+ "deprecated and will be replaced with gems.rb and gems.locked in " \
+ "Bundler 2.0.0.")
+ expect(err).to lack_errors
+ end
+ end
+
context "when `bundler/deployment` is required in a ruby script" do
it "should print a capistrano deprecation warning" do
install_gemfile <<-G
diff --git a/spec/cache/git_spec.rb b/spec/cache/git_spec.rb
index f94b1b3469..df77e39cb8 100644
--- a/spec/cache/git_spec.rb
+++ b/spec/cache/git_spec.rb
@@ -60,7 +60,7 @@ end
bundle "#{cmd} --all"
bundle "#{cmd} --all"
- expect(err).to eq("")
+ expect(err).to lack_errors
FileUtils.rm_rf lib_path("foo-1.0")
should_be_installed "foo 1.0"
end
diff --git a/spec/commands/binstubs_spec.rb b/spec/commands/binstubs_spec.rb
index 338f07100a..c400d7ecae 100644
--- a/spec/commands/binstubs_spec.rb
+++ b/spec/commands/binstubs_spec.rb
@@ -48,7 +48,7 @@ describe "bundle binstubs <gem>" do
bundle "binstubs"
expect(exitstatus).to eq(1) if exitstatus
- expect(out).to eq("`bundle binstubs` needs at least one gem to run.")
+ expect(out).to include("`bundle binstubs` needs at least one gem to run.")
end
it "does not bundle the bundler binary" do
@@ -59,7 +59,7 @@ describe "bundle binstubs <gem>" do
bundle "binstubs bundler"
expect(bundled_app("bin/bundle")).not_to exist
- expect(out).to eq("Sorry, Bundler can only be run via Rubygems.")
+ expect(out).to include("Sorry, Bundler can only be run via Rubygems.")
end
it "installs binstubs from git gems" do
@@ -115,7 +115,7 @@ describe "bundle binstubs <gem>" do
bundle "binstubs doesnt_exist"
expect(exitstatus).to eq(7) if exitstatus
- expect(out).to eq("Could not find gem 'doesnt_exist'.")
+ expect(out).to include("Could not find gem 'doesnt_exist'.")
end
end
diff --git a/spec/commands/check_spec.rb b/spec/commands/check_spec.rb
index 9f2053e15b..275585cc8b 100644
--- a/spec/commands/check_spec.rb
+++ b/spec/commands/check_spec.rb
@@ -10,7 +10,7 @@ describe "bundle check" do
bundle :check
expect(exitstatus).to eq(0) if exitstatus
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "works with the --gemfile flag when not in the directory" do
@@ -21,7 +21,7 @@ describe "bundle check" do
Dir.chdir tmp
bundle "check --gemfile bundled_app/Gemfile"
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "creates a Gemfile.lock by default if one does not exist" do
@@ -153,7 +153,7 @@ describe "bundle check" do
G
bundle :check
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "works with env conditionals" do
@@ -184,7 +184,7 @@ describe "bundle check" do
G
bundle :check
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "outputs an error when the default Gemfile is not found" do
@@ -211,7 +211,7 @@ describe "bundle check" do
3.times do
bundle :check
expect(out).to eq(last_out)
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
@@ -243,7 +243,7 @@ describe "bundle check" do
it "returns success" do
bundle "check --path vendor/bundle"
expect(exitstatus).to eq(0) if exitstatus
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "should write to .bundle/config" do
@@ -279,7 +279,7 @@ describe "bundle check" do
bundle :install
bundle :check
expect(exitstatus).to eq(0) if exitstatus
- expect(out).to eq("The Gemfile's dependencies are satisfied")
+ expect(out).to include("The Gemfile's dependencies are satisfied")
end
it "shows what is missing with the current Gemfile if it is not satisfied" do
diff --git a/spec/commands/clean_spec.rb b/spec/commands/clean_spec.rb
index 37f569b267..67d70b511c 100644
--- a/spec/commands/clean_spec.rb
+++ b/spec/commands/clean_spec.rb
@@ -37,7 +37,7 @@ describe "bundle clean" do
bundle :clean
- expect(out).to eq("Removing foo (1.0)")
+ expect(out).to include("Removing foo (1.0)")
should_have_gems "thin-1.0", "rack-1.0.0"
should_not_have_gems "foo-1.0"
@@ -65,7 +65,7 @@ describe "bundle clean" do
bundle :clean
- expect(out).to eq("Removing rack (0.9.1)")
+ expect(out).to include("Removing rack (0.9.1)")
should_have_gems "foo-1.0", "rack-1.0.0"
should_not_have_gems "rack-0.9.1"
@@ -93,7 +93,7 @@ describe "bundle clean" do
bundle :clean
- expect(out).to eq("Removing rack (1.0.0)")
+ expect(out).to include("Removing rack (1.0.0)")
should_have_gems "foo-1.0", "rack-0.9.1"
should_not_have_gems "rack-1.0.0"
@@ -116,7 +116,7 @@ describe "bundle clean" do
bundle "install --without test_group"
bundle :clean
- expect(out).to eq("Removing rack (1.0.0)")
+ expect(out).to include("Removing rack (1.0.0)")
should_have_gems "foo-1.0"
should_not_have_gems "rack-1.0.0"
@@ -171,7 +171,7 @@ describe "bundle clean" do
bundle :clean
- expect(out).to eq("Removing foo (#{revision[0..11]})")
+ expect(out).to include("Removing foo (#{revision[0..11]})")
expect(vendored_gems("gems/rack-1.0.0")).to exist
expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).not_to exist
@@ -204,7 +204,7 @@ describe "bundle clean" do
bundle "update"
bundle :clean
- expect(out).to eq("Removing foo-bar (#{revision[0..11]})")
+ expect(out).to include("Removing foo-bar (#{revision[0..11]})")
expect(vendored_gems("gems/rack-1.0.0")).to exist
expect(vendored_gems("bundler/gems/foo-bar-#{revision[0..11]}")).not_to exist
@@ -228,7 +228,7 @@ describe "bundle clean" do
bundle "install --path vendor/bundle"
bundle :clean
- expect(out).to eq("")
+ expect(out).to include("")
expect(vendored_gems("bundler/gems/rails-#{revision[0..11]}")).to exist
end
@@ -252,7 +252,7 @@ describe "bundle clean" do
bundle :clean
- expect(out).to eq("")
+ expect(out).to include("")
expect(vendored_gems("bundler/gems/foo-#{revision[0..11]}")).to exist
digest = Digest::SHA1.hexdigest(git_path.to_s)
expect(vendored_gems("cache/bundler/git/foo-#{digest}")).to_not exist
@@ -452,7 +452,7 @@ describe "bundle clean" do
bundle :install
bundle "clean --force"
- expect(out).to eq("Removing foo (1.0)")
+ expect(out).to include("Removing foo (1.0)")
sys_exec "gem list"
expect(out).not_to include("foo (1.0)")
expect(out).to include("rack (1.0.0)")
@@ -587,8 +587,8 @@ describe "bundle clean" do
bundle "clean --dry-run"
- expect(out).not_to eq("Removing foo (1.0)")
- expect(out).to eq("Would have removed foo (1.0)")
+ expect(out).not_to include("Removing foo (1.0)")
+ expect(out).to include("Would have removed foo (1.0)")
should_have_gems "thin-1.0", "rack-1.0.0", "foo-1.0"
@@ -616,8 +616,8 @@ describe "bundle clean" do
bundle "clean"
- expect(out).to eq("Removing foo (1.0)")
- expect(out).not_to eq("Would have removed foo (1.0)")
+ expect(out).to include("Removing foo (1.0)")
+ expect(out).not_to include("Would have removed foo (1.0)")
should_have_gems "thin-1.0", "rack-1.0.0"
should_not_have_gems "foo-1.0"
diff --git a/spec/commands/exec_spec.rb b/spec/commands/exec_spec.rb
index 25b240b0a9..cf10521fac 100644
--- a/spec/commands/exec_spec.rb
+++ b/spec/commands/exec_spec.rb
@@ -31,7 +31,7 @@ describe "bundle exec" do
bundle "exec 'cd #{tmp("gems")} && rackup'"
- expect(out).to eq("1.0.0")
+ expect(out).to include("1.0.0")
end
it "works when exec'ing something else" do
@@ -86,14 +86,14 @@ describe "bundle exec" do
expect(out).to eq("Ruby version #{RUBY_VERSION} defaults to keeping non-standard file descriptors on Kernel#exec.")
end
- expect(err).to eq("")
+ expect(err).to lack_errors
end
it "accepts --keep-file-descriptors" do
install_gemfile ""
bundle "exec --keep-file-descriptors echo foobar"
- expect(err).to eq("")
+ expect(err).to lack_errors
end
it "can run a command named --verbose" do
@@ -179,10 +179,10 @@ describe "bundle exec" do
rubylib = rubylib.uniq.join(File::PATH_SEPARATOR)
bundle "exec 'echo $RUBYLIB'"
- expect(out).to eq(rubylib)
+ expect(out).to include(rubylib)
bundle "exec 'echo $RUBYLIB'", :env => { "RUBYLIB" => rubylib }
- expect(out).to eq(rubylib)
+ expect(out).to include(rubylib)
end
it "errors nicely when the argument doesn't exist" do
@@ -316,12 +316,13 @@ describe "bundle exec" do
it "works when unlocked" do
bundle "exec 'cd #{tmp("gems")} && rackup'"
expect(out).to eq("1.0.0")
+ expect(out).to include("1.0.0")
end
it "works when locked" do
should_be_locked
bundle "exec 'cd #{tmp("gems")} && rackup'"
- expect(out).to eq("1.0.0")
+ expect(out).to include("1.0.0")
end
end
diff --git a/spec/commands/install_spec.rb b/spec/commands/install_spec.rb
index d4f75eef24..524071d989 100644
--- a/spec/commands/install_spec.rb
+++ b/spec/commands/install_spec.rb
@@ -17,7 +17,7 @@ describe "bundle install with gem sources" do
raise StandardError, "FAIL"
G
- expect(err).to eq ""
+ expect(err).to lack_errors
expect(out).to match(/StandardError, "FAIL"/)
expect(bundled_app("Gemfile.lock")).not_to exist
end
diff --git a/spec/commands/lock_spec.rb b/spec/commands/lock_spec.rb
index b204c6aad5..98eb98a789 100644
--- a/spec/commands/lock_spec.rb
+++ b/spec/commands/lock_spec.rb
@@ -57,7 +57,7 @@ describe "bundle lock" do
it "prints a lockfile when there is no existing lockfile with --print" do
bundle "lock --print"
- expect(out).to eq(@lockfile)
+ expect(out).to include(@lockfile)
end
it "prints a lockfile when there is an existing lockfile with --print" do
diff --git a/spec/commands/open_spec.rb b/spec/commands/open_spec.rb
index 8ae18cea6a..5507398382 100644
--- a/spec/commands/open_spec.rb
+++ b/spec/commands/open_spec.rb
@@ -11,17 +11,17 @@ describe "bundle open" do
it "opens the gem with BUNDLER_EDITOR as highest priority" do
bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" }
- expect(out).to eq("bundler_editor #{default_bundle_path("gems", "rails-2.3.2")}")
+ expect(out).to include("bundler_editor #{default_bundle_path("gems", "rails-2.3.2")}")
end
it "opens the gem with VISUAL as 2nd highest priority" do
bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "" }
- expect(out).to eq("visual #{default_bundle_path("gems", "rails-2.3.2")}")
+ expect(out).to include("visual #{default_bundle_path("gems", "rails-2.3.2")}")
end
it "opens the gem with EDITOR as 3rd highest priority" do
bundle "open rails", :env => { "EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => "" }
- expect(out).to eq("editor #{default_bundle_path("gems", "rails-2.3.2")}")
+ expect(out).to include("editor #{default_bundle_path("gems", "rails-2.3.2")}")
end
it "complains if no EDITOR is set" do
@@ -55,7 +55,7 @@ describe "bundle open" do
it "opens the gem with short words" do
bundle "open rec", :env => { "EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor" }
- expect(out).to eq("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}")
+ expect(out).to include("bundler_editor #{default_bundle_path("gems", "activerecord-2.3.2")}")
end
it "select the gem from many match gems" do
diff --git a/spec/commands/package_spec.rb b/spec/commands/package_spec.rb
index 3e4b602963..9c722b3491 100644
--- a/spec/commands/package_spec.rb
+++ b/spec/commands/package_spec.rb
@@ -266,7 +266,7 @@ describe "bundle install with gem sources" do
end
bundle :install
- expect(err).to be_empty
+ expect(err).to lack_errors
should_be_installed "rack 1.0"
end
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index 43bbc3f945..b4f9c90c95 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -133,7 +133,7 @@ describe "bundle show" do
it "does not output git errors" do
bundle :show
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
diff --git a/spec/commands/update_spec.rb b/spec/commands/update_spec.rb
index 31d5a21975..b1bf843f9b 100644
--- a/spec/commands/update_spec.rb
+++ b/spec/commands/update_spec.rb
@@ -274,7 +274,7 @@ describe "bundle update when a gem depends on a newer version of bundler" do
it "should not explode" do
bundle "update"
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "should explain that bundler conflicted" do
diff --git a/spec/install/bundler_spec.rb b/spec/install/bundler_spec.rb
index 835afa0e96..901c68d2a8 100644
--- a/spec/install/bundler_spec.rb
+++ b/spec/install/bundler_spec.rb
@@ -112,7 +112,7 @@ describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(out).to eq(nice_error)
+ expect(out).to include(nice_error)
end
it "causes a conflict if a child dependency conflicts with the Gemfile" do
@@ -132,7 +132,7 @@ describe "bundle install" do
rails_fail was resolved to 1.0, which depends on
activesupport (= 1.2.3)
E
- expect(out).to eq(nice_error)
+ expect(out).to include(nice_error)
end
it "can install dependencies with newer bundler version" do
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index 2cb62b424e..4f24a0b162 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -199,7 +199,7 @@ describe "bundle install with git sources" do
gem "foo"
end
G
- expect(err).to eq("")
+ expect(err).to lack_errors
run <<-RUBY
require 'foo'
@@ -852,7 +852,7 @@ describe "bundle install with git sources" do
bundle :install, :expect_err => true,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq("Ran pre-install hook: foo-1.0")
+ expect(err).to eq_err("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -872,7 +872,7 @@ describe "bundle install with git sources" do
bundle :install, :expect_err => true,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq("Ran post-install hook: foo-1.0")
+ expect(err).to eq_err("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
diff --git a/spec/install/gemfile/groups_spec.rb b/spec/install/gemfile/groups_spec.rb
index 2f3f446834..7d8768eca9 100644
--- a/spec/install/gemfile/groups_spec.rb
+++ b/spec/install/gemfile/groups_spec.rb
@@ -26,7 +26,7 @@ describe "bundle install with groups" do
puts ACTIVESUPPORT
R
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "installs gems with inline :groups into those groups" do
@@ -37,7 +37,7 @@ describe "bundle install with groups" do
puts THIN
R
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "sets up everything if Bundler.setup is used with no groups" do
@@ -58,7 +58,7 @@ describe "bundle install with groups" do
puts THIN
RUBY
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "sets up old groups when they have previously been removed" do
@@ -365,7 +365,7 @@ describe "bundle install with groups" do
it "does not hit the remote a second time" do
FileUtils.rm_rf gem_repo2
bundle "install --without rack"
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
end
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index 39b0aed788..50fc1abac5 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -289,7 +289,7 @@ describe "bundle install with explicit source paths" do
install_gemfile <<-G
gem 'foo', '1.0', :path => "#{lib_path("foo-1.0")}"
G
- expect(err).to eq("")
+ expect(err).to lack_errors
end
it "removes the .gem file after installing" do
@@ -551,7 +551,7 @@ describe "bundle install with explicit source paths" do
bundle :install, :expect_err => true,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq("Ran pre-install hook: foo-1.0")
+ expect(err).to eq_err("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -571,7 +571,7 @@ describe "bundle install with explicit source paths" do
bundle :install, :expect_err => true,
:requires => [lib_path("install_hooks.rb")]
- expect(err).to eq("Ran post-install hook: foo-1.0")
+ expect(err).to eq_err("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
diff --git a/spec/install/gemspecs_spec.rb b/spec/install/gemspecs_spec.rb
index aa3085b0d7..58e086b4b2 100644
--- a/spec/install/gemspecs_spec.rb
+++ b/spec/install/gemspecs_spec.rb
@@ -15,7 +15,7 @@ describe "bundle install" do
gem "yaml_spec"
G
bundle :install
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "still installs correctly when using path" do
@@ -24,7 +24,7 @@ describe "bundle install" do
install_gemfile <<-G
gem 'yaml_spec', :path => "#{lib_path("yaml_spec-1.0")}"
G
- expect(err).to eq("")
+ expect(err).to lack_errors
end
end
diff --git a/spec/other/cli_dispatch_spec.rb b/spec/other/cli_dispatch_spec.rb
index 7aee482bfe..9d57a90420 100644
--- a/spec/other/cli_dispatch_spec.rb
+++ b/spec/other/cli_dispatch_spec.rb
@@ -4,19 +4,19 @@ require "spec_helper"
describe "bundle command names" do
it "work when given fully" do
bundle "install"
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).not_to match(/Ambiguous command/)
end
it "work when not ambiguous" do
bundle "ins"
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).not_to match(/Ambiguous command/)
end
it "print a friendly error when ambiguous" do
- bundle "in"
- expect(err).to eq("")
+ bundle "i"
+ expect(err).to lack_errors
expect(out).to match(/Ambiguous command/)
end
end
diff --git a/spec/realworld/edgecases_spec.rb b/spec/realworld/edgecases_spec.rb
index 89de134cc4..5c6835ed39 100644
--- a/spec/realworld/edgecases_spec.rb
+++ b/spec/realworld/edgecases_spec.rb
@@ -9,7 +9,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
gem "linecache", "0.46"
G
bundle :lock
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(exitstatus).to eq(0) if exitstatus
end
@@ -91,7 +91,7 @@ describe "real world edgecases", :realworld => true, :sometimes => true do
bundle "install --path vendor/bundle", :expect_err => true
expect(err).not_to include("Could not find rake")
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "checks out git repos when the lockfile is corrupted" do
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index 5ddf1ef013..d565be7194 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -120,7 +120,7 @@ describe "Bundler.require" do
Bundler.require
R
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "displays a helpful message if the required gem throws an error" do
@@ -157,7 +157,7 @@ describe "Bundler.require" do
RUBY
run(cmd, :expect_err => true)
- expect(err).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
describe "with namespaced gems" do
@@ -193,7 +193,7 @@ describe "Bundler.require" do
RUBY
ruby(cmd, :expect_err => true)
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "does not mangle explictly given requires" do
@@ -205,7 +205,7 @@ describe "Bundler.require" do
load_error_run <<-R, "jquery-rails"
Bundler.require
R
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "handles the case where regex fails" do
@@ -227,7 +227,7 @@ describe "Bundler.require" do
RUBY
run(cmd, :expect_err => true)
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
it "doesn't swallow the error when the library has an unrelated error" do
@@ -250,7 +250,7 @@ describe "Bundler.require" do
RUBY
run(cmd, :expect_err => true)
- expect(err).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
end
@@ -356,7 +356,7 @@ describe "Bundler.require" do
load_error_run <<-R, "no_such_file_omg"
Bundler.require
R
- expect(err).to eq("ZOMG LOAD ERROR")
+ expect(err).to eq_err("ZOMG LOAD ERROR")
end
end
end
@@ -375,7 +375,7 @@ describe "Bundler.require with platform specific dependencies" do
G
run "Bundler.require", :expect_err => true
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "requires gems pinned to multiple platforms, including the current one" do
@@ -390,6 +390,6 @@ describe "Bundler.require with platform specific dependencies" do
run "Bundler.require; puts RACK", :expect_err => true
expect(out).to eq("1.0.0")
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb
index aa74d83ba4..18abf0549e 100644
--- a/spec/runtime/setup_spec.rb
+++ b/spec/runtime/setup_spec.rb
@@ -17,7 +17,7 @@ describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to eq("1.0.0")
end
end
@@ -43,7 +43,7 @@ describe "Bundler.setup" do
puts "WIN"
end
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to eq("WIN")
end
@@ -56,7 +56,7 @@ describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to eq("1.0.0")
end
@@ -70,7 +70,7 @@ describe "Bundler.setup" do
require 'rack'
puts RACK
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to eq("1.0.0")
end
@@ -88,7 +88,7 @@ describe "Bundler.setup" do
puts "FAIL"
end
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to match("WIN")
end
@@ -305,7 +305,7 @@ describe "Bundler.setup" do
end
R
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "replaces #gem but raises when the version is wrong" do
@@ -331,7 +331,7 @@ describe "Bundler.setup" do
end
R
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
@@ -647,7 +647,7 @@ describe "Bundler.setup" do
end
R
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
end
@@ -682,7 +682,7 @@ describe "Bundler.setup" do
ENV["GEM_HOME"] = ""
bundle %(exec ruby -e "require 'set'")
- expect(err).to be_empty
+ expect(err).to lack_errors
end
it "should prepend gemspec require paths to $LOAD_PATH in order" do
@@ -771,7 +771,7 @@ describe "Bundler.setup" do
require 'foo'
R
end
- expect(err).to eq("")
+ expect(err).to lack_errors
end
it "should make sure the Bundler.root is really included in the path relative to the Gemfile" do
@@ -796,7 +796,7 @@ describe "Bundler.setup" do
R
end
- expect(err).to eq("")
+ expect(err).to lack_errors
end
end
@@ -943,7 +943,7 @@ describe "Bundler.setup" do
Bundler.load
RUBY
- expect(err).to eq("")
+ expect(err).to lack_errors
expect(out).to eq("")
end
end
@@ -955,7 +955,7 @@ describe "Bundler.setup" do
G
bundle %(exec ruby -e "require 'bundler'; Bundler.setup")
- expect(err).to be_empty
+ expect(err).to lack_errors
end
end
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 1a05c76637..aee6e88d13 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -1,6 +1,18 @@
# frozen_string_literal: true
module Spec
module Matchers
+ RSpec::Matchers.define :lack_errors do
+ match do |actual|
+ actual.gsub(/(^DEPRECATION:.+)/, "") == ""
+ end
+ end
+
+ RSpec::Matchers.define :eq_err do |expected|
+ match do |actual|
+ actual.gsub(/(^DEPRECATION:.+\n)/, "") == expected
+ end
+ end
+
RSpec::Matchers.define :have_dep do |*args|
dep = Bundler::Dependency.new(*args)
diff --git a/spec/update/git_spec.rb b/spec/update/git_spec.rb
index 644bbad80c..25dff6818e 100644
--- a/spec/update/git_spec.rb
+++ b/spec/update/git_spec.rb
@@ -90,7 +90,7 @@ describe "bundle update" do
gem "foo", "1.0", :git => "#{lib_path("foo_two")}"
G
- expect(err).to be_empty
+ expect(err).to lack_errors
expect(out).to include("Fetching #{lib_path}/foo_two")
expect(out).to include("Bundle complete!")
end