Ensure true or false for automount option

This commit is contained in:
Brian Cain 2018-10-23 09:00:55 -07:00
parent 6d0dfb2690
commit 7c06950e43
No known key found for this signature in database
GPG Key ID: 9FC4639B2E4510A0
2 changed files with 9 additions and 7 deletions

View File

@ -125,9 +125,8 @@ module VagrantPlugins
hostpath: hostpath.to_s,
transient: transient,
SharedFoldersEnableSymlinksCreate: enable_symlink_create,
automount: data[:automount]
}.delete_if { |_,v| v.nil?}
automount: !!data[:automount]
}
end
end

View File

@ -43,6 +43,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
{:SharedFoldersEnableSymlinksCreate=>true,
:guestpath=>"/folder",
:hostpath=>"/Users/brian/vagrant-folder",
:automount=>false,
:disabled=>false,
:__vagrantfile=>true}} }
@ -50,6 +51,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
{:SharedFoldersEnableSymlinksCreate=>false,
:guestpath=>"/folder",
:hostpath=>"/Users/brian/vagrant-folder",
:automount=>false,
:disabled=>false,
:__vagrantfile=>true}} }
@ -65,6 +67,7 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
let(:folders_nosymvar) { {"/folder"=>
{:guestpath=>"/folder",
:hostpath=>"/Users/brian/vagrant-folder",
:automount=>false,
:disabled=>false,
:__vagrantfile=>true}} }
@ -75,26 +78,26 @@ describe VagrantPlugins::ProviderVirtualBox::SyncedFolder do
end
it "should prepare and share the folders" do
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>true}])
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>true}])
subject.prepare(machine, folders, nil)
end
it "should prepare and share the folders without symlinks enabled" do
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>false}])
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>false}])
subject.prepare(machine, folders_disabled, nil)
end
it "should prepare and share the folders without symlinks enabled with env var set" do
stub_env('VAGRANT_DISABLE_VBOXSYMLINKCREATE'=>'1')
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>false}])
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>false}])
subject.prepare(machine, folders_nosymvar, nil)
end
it "should prepare and share the folders and override symlink setting" do
stub_env('VAGRANT_DISABLE_VBOXSYMLINKCREATE'=>'1')
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :SharedFoldersEnableSymlinksCreate=>true}])
expect(driver).to receive(:share_folders).with([{:name=>"folder", :hostpath=>"/Users/brian/vagrant-folder", :transient=>false, :automount=>false, :SharedFoldersEnableSymlinksCreate=>true}])
subject.prepare(machine, folders, nil)
end