If no shared folders existed, don't worry about clearing them

This commit is contained in:
Mitchell Hashimoto 2010-06-03 20:35:12 -07:00
parent 97facb08fd
commit b13de6a497
2 changed files with 14 additions and 6 deletions

View File

@ -31,14 +31,16 @@ module Vagrant
end end
def clear_shared_folders def clear_shared_folders
logger.info "Clearing previously set shared folders..." if runner.vm.shared_folders.length > 0
logger.info "Clearing previously set shared folders..."
folders = @runner.vm.shared_folders.dup folders = @runner.vm.shared_folders.dup
folders.each do |shared_folder| folders.each do |shared_folder|
shared_folder.destroy shared_folder.destroy
end
@runner.reload!
end end
@runner.reload!
end end
def create_metadata def create_metadata

View File

@ -81,6 +81,12 @@ class SharedFoldersActionTest < Test::Unit::TestCase
@runner.expects(:reload!).once.in_sequence(destroy_seq) @runner.expects(:reload!).once.in_sequence(destroy_seq)
@action.clear_shared_folders @action.clear_shared_folders
end end
should "do nothing if no shared folders existed" do
@shared_folders.clear
@runner.expects(:reload!).never
@action.clear_shared_folders
end
end end
context "setting up shared folder metadata" do context "setting up shared folder metadata" do