2014-04-22 18:03:37 +00:00
|
|
|
require File.expand_path("../../../../base", __FILE__)
|
|
|
|
|
|
|
|
require Vagrant.source_root.join("plugins/guests/windows/config")
|
|
|
|
|
|
|
|
describe VagrantPlugins::GuestWindows::Config do
|
|
|
|
let(:machine) { double("machine") }
|
|
|
|
|
|
|
|
subject { described_class.new }
|
|
|
|
|
|
|
|
it "is valid by default" do
|
|
|
|
subject.finalize!
|
|
|
|
result = subject.validate(machine)
|
|
|
|
expect(result["Windows Guest"]).to be_empty
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "default values" do
|
|
|
|
before { subject.finalize! }
|
2014-05-01 15:00:41 +00:00
|
|
|
its("set_work_network") { should == false }
|
2014-04-22 18:03:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "attributes" do
|
2014-05-01 15:00:41 +00:00
|
|
|
[:set_work_network].each do |attribute|
|
2014-04-22 18:03:37 +00:00
|
|
|
it "should not default #{attribute} if overridden" do
|
|
|
|
subject.send("#{attribute}=".to_sym, 10)
|
|
|
|
subject.finalize!
|
2017-04-06 21:57:46 +00:00
|
|
|
expect(subject.send(attribute)).to be(10)
|
2014-04-22 18:03:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "should return error #{attribute} if nil" do
|
|
|
|
subject.send("#{attribute}=".to_sym, nil)
|
|
|
|
subject.finalize!
|
|
|
|
result = subject.validate(machine)
|
|
|
|
expect(result["Windows Guest"]).to include("windows.#{attribute} cannot be nil.")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|