core: Prefixed UI only requests bolding if not specified at instance-level

This commit is contained in:
Mitchell Hashimoto 2014-02-08 14:26:26 -08:00
parent efc1bf50dd
commit 1e50e7aca1
2 changed files with 8 additions and 2 deletions

View File

@ -221,7 +221,7 @@ module Vagrant
class_eval <<-CODE
def #{method}(message, *args, **opts)
super(message)
if !opts.has_key?(:bold)
if !@ui.opts.has_key?(:bold) && !opts.has_key?(:bold)
opts[:bold] = #{method.inspect} != :detail && \
#{method.inspect} != :ask
end

View File

@ -255,7 +255,7 @@ describe Vagrant::UI::Prefixed do
subject.detail("foo\nbar")
end
it "doesn't prefix if requestsed" do
it "doesn't prefix if requested" do
ui.should_receive(:detail).with("foo", prefix: false, bold: false)
subject.detail("foo", prefix: false)
end
@ -300,5 +300,11 @@ describe Vagrant::UI::Prefixed do
ui.should_receive(:output).with("==> #{prefix}: foo", bold: true)
subject.output("foo")
end
it "does not request bolding if class-level disabled" do
ui.opts[:bold] = false
ui.should_receive(:output).with("==> #{prefix}: foo", {})
subject.output("foo")
end
end
end