spec/unit/berkshelf/ui_spec.rb in berkshelf-3.0.0.beta9 vs spec/unit/berkshelf/ui_spec.rb in berkshelf-3.0.0.rc1

- old
+ new

@@ -1,9 +1,9 @@ require 'spec_helper' describe Thor::Base.shell do - let(:stdout) { double('stdout') } + let(:stdout) { double('stdout', tty?: true) } let(:stderr) { double('stderr') } before do described_class.any_instance.stub(:stdout).and_return(stdout) described_class.any_instance.stub(:stderr).and_return(stderr) @@ -28,22 +28,22 @@ before do subject.stub(:quiet?).and_return(true) end it 'does not output anything', :not_supported_on_windows do - stdout.should_not_receive(:puts) + stdout.should_not_receive(:print) subject.say 'message' end end context 'with not quiet?' do before do subject.stub(:quiet?).and_return(false) end it 'prints to stdout' do - stdout.should_receive(:puts).with('message').once + stdout.should_receive(:print).once stdout.should_receive(:flush).with(no_args()) subject.say 'message' end end end @@ -64,11 +64,11 @@ before do subject.stub(:quiet?).and_return(false) end it 'prints to stdout' do - stdout.should_receive(:puts).with(windows? ? " 5 message" : "\e[1m\e[32m 5\e[0m message") + stdout.should_receive(:print).once stdout.should_receive(:flush).with(no_args()) subject.say_status 5, 'message' end end end @@ -78,22 +78,21 @@ before do subject.stub(:quiet?).and_return(true) end it 'does not output anything' do - stdout.should_not_receive(:puts) + stdout.should_not_receive(:print) subject.warn 'warning' end end context 'with not quiet?' do before do subject.stub(:quiet?).and_return(false) end it 'calls #say with yellow coloring' do - stdout.stub :tty? - stdout.should_receive(:puts).with("warning") + stdout.should_receive(:print) stdout.should_receive(:flush).with(no_args()) subject.warn 'warning' end end end