summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-05-17 07:53:31 +1000
committerColby Swandale <colby@taplaboratories.com>2017-05-17 07:53:31 +1000
commit7a47ace072df309b7fd8020bce1ef56548ba2cce (patch)
tree37cb52ec0aa76e03ee951f9ababc8c994934e2b9
parent474996bd826f173e00cbcd1729068997b7477f5e (diff)
downloadbundler-7a47ace072df309b7fd8020bce1ef56548ba2cce.tar.gz
fix not checking error level before printing to stderr
-rw-r--r--lib/bundler/ui/shell.rb3
-rw-r--r--spec/bundler/ui/shell_spec.rb4
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/ui/shell.rb b/lib/bundler/ui/shell.rb
index 56b4b2e7f4..98c3206337 100644
--- a/lib/bundler/ui/shell.rb
+++ b/lib/bundler/ui/shell.rb
@@ -36,8 +36,9 @@ module Bundler
end
def error(msg, newline = nil)
+ return unless level("error")
return tell_err(msg, :red, newline) if Bundler.feature_flag.stderr?
- tell_me(msg, :red, newline) if level("error")
+ tell_me(msg, :red, newline)
end
def debug(msg, newline = nil)
diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb
index e80e79939a..022fa22a9c 100644
--- a/spec/bundler/ui/shell_spec.rb
+++ b/spec/bundler/ui/shell_spec.rb
@@ -7,18 +7,21 @@ RSpec.describe Bundler::UI::Shell do
before { subject.level = "debug" }
describe "#info" do
+ before { subject.level = "info" }
it "prints to stdout" do
expect { subject.info("info") }.to output("info\n").to_stdout
end
end
describe "#confirm" do
+ before { subject.level = "confirm" }
it "prints to stdout" do
expect { subject.confirm("confirm") }.to output("confirm\n").to_stdout
end
end
describe "#warn" do
+ before { subject.level = "warn" }
it "prints to stdout" do
expect { subject.warn("warning") }.to output("warning\n").to_stdout
end
@@ -31,6 +34,7 @@ RSpec.describe Bundler::UI::Shell do
end
describe "#error" do
+ before { subject.level = "error" }
it "prints to stdout" do
expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout
end