From e6ca9d6f8193d132c8fb14bad74ae7b832d0e351 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Feb 2014 15:14:21 -0800 Subject: [PATCH] core: Ui::Prefixed can take prefix_spaces option --- lib/vagrant/ui.rb | 2 +- test/unit/vagrant/ui_test.rb | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/ui.rb b/lib/vagrant/ui.rb index 006928113..e435d20d5 100644 --- a/lib/vagrant/ui.rb +++ b/lib/vagrant/ui.rb @@ -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 diff --git a/test/unit/vagrant/ui_test.rb b/test/unit/vagrant/ui_test.rb index 586403c75..1256eb3ee 100644 --- a/test/unit/vagrant/ui_test.rb +++ b/test/unit/vagrant/ui_test.rb @@ -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")