From 836468a51eab8ce62b8e9a2c13a76ccc34520cbf Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 10 Jan 2012 21:20:24 -0800 Subject: [PATCH] Test the `:create` flag on shared folders --- test/acceptance/up_basic_test.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/test/acceptance/up_basic_test.rb b/test/acceptance/up_basic_test.rb index 0138ace5d..1605d76d5 100644 --- a/test/acceptance/up_basic_test.rb +++ b/test/acceptance/up_basic_test.rb @@ -45,4 +45,33 @@ describe "vagrant up", "basics" do assert_execute("vagrant", "ssh", "-c", "touch /vagrant/foo") foofile.exist?.should be, "'foo' should exist since it was touched in the shared folder" end + + it "should create a shared folder if the :create flag is set" do + initialize_valid_environment + + # Setup the custom Vagrantfile + environment.workdir.join("Vagrantfile").open("w+") do |f| + f.write(<<-VF) +Vagrant::Config.run do |config| + config.vm.box = "base" + config.vm.share_folder "v-root", "/vagrant", "./data", :create => true +end +VF + end + + data_dir = environment.workdir.join("data") + + # Verify the directory doesn't exist prior, for sanity + data_dir.exist?.should_not be + + # Bring up the VM + assert_execute("vagrant", "up") + + # Verify the directory exists + data_dir.should be_directory + + # Touch a file and verify it is shared + assert_execute("vagrant", "ssh", "-c", "touch /vagrant/foo") + data_dir.join("foo").exist?.should be + end end