core: ui can hide details

This commit is contained in:
Mitchell Hashimoto 2014-02-13 21:09:02 -08:00
parent d0cd2464b2
commit a4f64d0148
2 changed files with 21 additions and 0 deletions

View File

@ -182,6 +182,9 @@ module Vagrant
defaults = { :new_line => true, :prefix => true }
opts = defaults.merge(@opts).merge(opts)
# Don't output if we're hiding details
return if type == :detail && opts[:hide_detail]
# Determine whether we're expecting to output our
# own new line or not.
printer = opts[:new_line] ? :puts : :print

View File

@ -58,6 +58,24 @@ describe Vagrant::UI::Basic do
subject.error("foo")
end
end
context "#detail" do
it "outputs details" do
subject.should_receive(:safe_puts).with do |message, **opts|
expect(message).to eq("foo")
true
end
subject.detail("foo")
end
it "doesn't output details if disabled" do
subject.should_receive(:safe_puts).never
subject.opts[:hide_detail] = true
subject.detail("foo")
end
end
end
describe Vagrant::UI::Colored do