summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorColby Swandale <colby@taplaboratories.com>2017-05-16 20:05:58 +1000
committerColby Swandale <colby@taplaboratories.com>2017-05-16 21:09:50 +1000
commit2bbf8d7dc019eb0cd658a1d505d9cbfe015a066a (patch)
tree491da0bbb9ac6d3daf4b45d152a086bcb533f34b /spec
parent31297d10a33e095e2f4b523b99264f777eb0238d (diff)
downloadbundler-2bbf8d7dc019eb0cd658a1d505d9cbfe015a066a.tar.gz
add print error to stderr feature
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/ui/shell_spec.rb45
1 files changed, 45 insertions, 0 deletions
diff --git a/spec/bundler/ui/shell_spec.rb b/spec/bundler/ui/shell_spec.rb
new file mode 100644
index 0000000000..e80e79939a
--- /dev/null
+++ b/spec/bundler/ui/shell_spec.rb
@@ -0,0 +1,45 @@
+# frozen_string_literal: true
+require "spec_helper"
+
+RSpec.describe Bundler::UI::Shell do
+ subject { described_class.new }
+
+ before { subject.level = "debug" }
+
+ describe "#info" do
+ it "prints to stdout" do
+ expect { subject.info("info") }.to output("info\n").to_stdout
+ end
+ end
+
+ describe "#confirm" do
+ it "prints to stdout" do
+ expect { subject.confirm("confirm") }.to output("confirm\n").to_stdout
+ end
+ end
+
+ describe "#warn" do
+ it "prints to stdout" do
+ expect { subject.warn("warning") }.to output("warning\n").to_stdout
+ end
+ end
+
+ describe "#debug" do
+ it "prints to stdout" do
+ expect { subject.debug("debug") }.to output("debug\n").to_stdout
+ end
+ end
+
+ describe "#error" do
+ it "prints to stdout" do
+ expect { subject.error("error!!!") }.to output("error!!!\n").to_stdout
+ end
+
+ context "when stderr flag is enabled" do
+ before { bundle "config stderr true" }
+ it "prints to stderr" do
+ expect { subject.error("error!!!") }.to output("\e[31merror!!!\e[0m").to_stderr
+ end
+ end
+ end
+end