From 7988f0fb7c2f427db067942a8da576ff90750bb1 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 22 Oct 2014 09:44:48 -0700 Subject: [PATCH] Fix broken unit tests --- lib/vagrant/action/builtin/mixin_synced_folders.rb | 10 ++++++---- .../virtualbox/action/prepare_nfs_settings.rb | 1 + .../virtualbox/action/prepare_nfs_settings_test.rb | 4 ++++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/vagrant/action/builtin/mixin_synced_folders.rb b/lib/vagrant/action/builtin/mixin_synced_folders.rb index 42e3a290f..b636d3526 100644 --- a/lib/vagrant/action/builtin/mixin_synced_folders.rb +++ b/lib/vagrant/action/builtin/mixin_synced_folders.rb @@ -112,10 +112,12 @@ module Vagrant raise "Internal error. Report this as a bug. Invalid: #{data[:type]}" end - if !impl_class[0].new.usable?(machine, true) - # Verify that explicitly defined shared folder types are - # actually usable. - raise Errors::SyncedFolderUnusable, type: data[:type].to_s + if !opts[:disable_usable_check] + if !impl_class[0].new.usable?(machine, true) + # Verify that explicitly defined shared folder types are + # actually usable. + raise Errors::SyncedFolderUnusable, type: data[:type].to_s + end end end diff --git a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb index b7a92d1ac..9835f0f43 100644 --- a/plugins/providers/virtualbox/action/prepare_nfs_settings.rb +++ b/plugins/providers/virtualbox/action/prepare_nfs_settings.rb @@ -20,6 +20,7 @@ module VagrantPlugins opts = { cached: !!env[:synced_folders_cached], config: env[:synced_folders_config], + disable_usable_check: !!env[:test], } folders = synced_folders(env[:machine], **opts) diff --git a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb index 8acc6fa28..dfef293ec 100644 --- a/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb +++ b/test/unit/plugins/providers/virtualbox/action/prepare_nfs_settings_test.rb @@ -25,6 +25,10 @@ describe VagrantPlugins::ProviderVirtualBox::Action::PrepareNFSSettings do subject { described_class.new(app, env) } + before do + env[:test] = true + end + it "calls the next action in the chain" do called = false app = lambda { |*args| called = true }