core: Ui::Prefixed can take prefix_spaces option

This commit is contained in:
Mitchell Hashimoto 2014-02-08 15:14:21 -08:00
parent 2d7c161f49
commit e6ca9d6f81
2 changed files with 6 additions and 1 deletions

View File

@ -267,7 +267,7 @@ module Vagrant
if !opts.has_key?(:prefix) || opts[:prefix]
prefix = OUTPUT_PREFIX
prefix = " " * OUTPUT_PREFIX.length if \
type == :detail || type == :ask
type == :detail || type == :ask || opts[:prefix_spaces]
end
# Fast-path if there is no prefix

View File

@ -293,6 +293,11 @@ describe Vagrant::UI::Prefixed do
subject.output("foo")
end
it "prefixes with spaces if requested" do
ui.should_receive(:output).with(" #{prefix}: foo", anything)
subject.output("foo", prefix_spaces: true)
end
it "prefixes every line" do
ui.should_receive(:output).with("==> #{prefix}: foo\n==> #{prefix}: bar", anything)
subject.output("foo\nbar")