fix failing tests

This commit is contained in:
Mitchell Hashimoto 2015-12-02 18:03:08 -08:00
parent 350da6e1d5
commit 30d9e243bb
2 changed files with 10 additions and 8 deletions

View File

@ -280,8 +280,9 @@ module Vagrant
opts[:bold] = #{method.inspect} != :detail && \ opts[:bold] = #{method.inspect} != :detail && \
#{method.inspect} != :ask #{method.inspect} != :ask
end end
if !opts.key?(:target)
opts[:target] = @prefix opts[:target] = @prefix
end
@ui.#{method}(format_message(#{method.inspect}, message, **opts), *args, **opts) @ui.#{method}(format_message(#{method.inspect}, message, **opts), *args, **opts)
end end
CODE CODE

View File

@ -313,7 +313,7 @@ describe Vagrant::UI::Prefixed do
describe "#ask" do describe "#ask" do
it "does not request bolding" do it "does not request bolding" do
expect(ui).to receive(:ask).with(" #{prefix}: foo", bold: false) expect(ui).to receive(:ask).with(" #{prefix}: foo", bold: false, target: prefix)
subject.ask("foo") subject.ask("foo")
end end
end end
@ -325,12 +325,13 @@ describe Vagrant::UI::Prefixed do
end end
it "prefixes every line" do it "prefixes every line" do
expect(ui).to receive(:detail).with(" #{prefix}: foo\n #{prefix}: bar", bold: false) expect(ui).to receive(:detail).with(
" #{prefix}: foo\n #{prefix}: bar", bold: false, target: prefix)
subject.detail("foo\nbar") subject.detail("foo\nbar")
end end
it "doesn't prefix if requested" do it "doesn't prefix if requested" do
expect(ui).to receive(:detail).with("foo", prefix: false, bold: false) expect(ui).to receive(:detail).with("foo", prefix: false, bold: false, target: prefix)
subject.detail("foo", prefix: false) subject.detail("foo", prefix: false)
end end
end end
@ -371,18 +372,18 @@ describe Vagrant::UI::Prefixed do
end end
it "doesn't prefix if requestsed" do it "doesn't prefix if requestsed" do
expect(ui).to receive(:output).with("foo", prefix: false, bold: true) expect(ui).to receive(:output).with("foo", prefix: false, bold: true, target: prefix)
subject.output("foo", prefix: false) subject.output("foo", prefix: false)
end end
it "requests bolding" do it "requests bolding" do
expect(ui).to receive(:output).with("==> #{prefix}: foo", bold: true) expect(ui).to receive(:output).with("==> #{prefix}: foo", bold: true, target: prefix)
subject.output("foo") subject.output("foo")
end end
it "does not request bolding if class-level disabled" do it "does not request bolding if class-level disabled" do
ui.opts[:bold] = false ui.opts[:bold] = false
expect(ui).to receive(:output).with("==> #{prefix}: foo", {}) expect(ui).to receive(:output).with("==> #{prefix}: foo", target: prefix)
subject.output("foo") subject.output("foo")
end end