From 2bbf8d7dc019eb0cd658a1d505d9cbfe015a066a Mon Sep 17 00:00:00 2001 From: Colby Swandale Date: Tue, 16 May 2017 20:05:58 +1000 Subject: add print error to stderr feature --- spec/bundler/ui/shell_spec.rb | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 spec/bundler/ui/shell_spec.rb (limited to 'spec/bundler/ui') 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 -- cgit v1.2.1