summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-14 13:43:52 +0100
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-03-14 14:49:09 +0100
commitb700a8a3e63cf0e926cdc8461320bd3275fd2824 (patch)
tree46d77bb49c80349c678fd68fc4d75cb653f071cc
parenta87cdf6ffdc31a51db6f1598de294c5a261d7d79 (diff)
downloadbundler-b700a8a3e63cf0e926cdc8461320bd3275fd2824.tar.gz
Remove `eq_err` matcher
In favor of a simpler helper.
-rw-r--r--spec/commands/show_spec.rb2
-rw-r--r--spec/install/gemfile/git_spec.rb4
-rw-r--r--spec/install/gemfile/groups_spec.rb6
-rw-r--r--spec/install/gemfile/path_spec.rb4
-rw-r--r--spec/runtime/require_spec.rb12
-rw-r--r--spec/support/helpers.rb6
-rw-r--r--spec/support/matchers.rb7
7 files changed, 20 insertions, 21 deletions
diff --git a/spec/commands/show_spec.rb b/spec/commands/show_spec.rb
index 8e3d0194e6..298618747f 100644
--- a/spec/commands/show_spec.rb
+++ b/spec/commands/show_spec.rb
@@ -157,7 +157,7 @@ RSpec.describe "bundle show" do
it "does not output git errors" do
bundle :show
- expect(last_command.stderr).to eq_err("")
+ expect(err_without_deprecations).to be_empty
end
end
diff --git a/spec/install/gemfile/git_spec.rb b/spec/install/gemfile/git_spec.rb
index cac571754c..2cb6c7485f 100644
--- a/spec/install/gemfile/git_spec.rb
+++ b/spec/install/gemfile/git_spec.rb
@@ -1067,7 +1067,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(last_command.stderr).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -1087,7 +1087,7 @@ RSpec.describe "bundle install with git sources" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(last_command.stderr).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("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 1b739e18ce..2787172057 100644
--- a/spec/install/gemfile/groups_spec.rb
+++ b/spec/install/gemfile/groups_spec.rb
@@ -25,7 +25,7 @@ RSpec.describe "bundle install with groups" do
puts ACTIVESUPPORT
R
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "installs gems with inline :groups into those groups" do
@@ -36,7 +36,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
R
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up everything if Bundler.setup is used with no groups" do
@@ -57,7 +57,7 @@ RSpec.describe "bundle install with groups" do
puts THIN
RUBY
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "sets up old groups when they have previously been removed" do
diff --git a/spec/install/gemfile/path_spec.rb b/spec/install/gemfile/path_spec.rb
index 224c28269e..40c137cd4a 100644
--- a/spec/install/gemfile/path_spec.rb
+++ b/spec/install/gemfile/path_spec.rb
@@ -575,7 +575,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(last_command.stderr).to eq_err("Ran pre-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran pre-install hook: foo-1.0")
end
it "runs post-install hooks" do
@@ -595,7 +595,7 @@ RSpec.describe "bundle install with explicit source paths" do
bundle :install,
:requires => [lib_path("install_hooks.rb")]
- expect(last_command.stderr).to eq_err("Ran post-install hook: foo-1.0")
+ expect(err_without_deprecations).to eq("Ran post-install hook: foo-1.0")
end
it "complains if the install hook fails" do
diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb
index 7a32fc6117..c9cfa199d3 100644
--- a/spec/runtime/require_spec.rb
+++ b/spec/runtime/require_spec.rb
@@ -121,7 +121,7 @@ RSpec.describe "Bundler.require" do
Bundler.require
R
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "displays a helpful message if the required gem throws an error" do
@@ -160,7 +160,7 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
describe "with namespaced gems" do
@@ -211,7 +211,7 @@ RSpec.describe "Bundler.require" do
load_error_run <<-R, "jquery-rails"
Bundler.require
R
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "handles the case where regex fails" do
@@ -234,7 +234,7 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
it "doesn't swallow the error when the library has an unrelated error" do
@@ -258,7 +258,7 @@ RSpec.describe "Bundler.require" do
RUBY
run(cmd)
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR: cannot load such file -- load-bar")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR: cannot load such file -- load-bar")
end
end
@@ -366,7 +366,7 @@ RSpec.describe "Bundler.require" do
load_error_run <<-R, "no_such_file_omg"
Bundler.require
R
- expect(last_command.stderr).to eq_err("ZOMG LOAD ERROR")
+ expect(err_without_deprecations).to eq("ZOMG LOAD ERROR")
end
end
end
diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb
index a5ff292f01..b4ea1db78d 100644
--- a/spec/support/helpers.rb
+++ b/spec/support/helpers.rb
@@ -48,6 +48,12 @@ module Spec
Bundler.feature_flag.error_on_stderr? ? last_command.stderr : last_command.stdout
end
+ MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
+
+ def err_without_deprecations
+ last_command.stderr.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "")
+ end
+
def exitstatus
last_command.exitstatus
end
diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb
index 2e2c51edfa..090618c2b5 100644
--- a/spec/support/matchers.rb
+++ b/spec/support/matchers.rb
@@ -62,13 +62,6 @@ module Spec
MAJOR_DEPRECATION = /^\[DEPRECATED\]\s*/.freeze
- RSpec::Matchers.define :eq_err do |expected|
- diffable
- match do |actual|
- actual.gsub(/#{MAJOR_DEPRECATION}.+[\n]?/, "") == expected
- end
- end
-
RSpec::Matchers.define :have_major_deprecation do |expected|
diffable
match do |actual|