From 60a350f9c7cf5ae48387f7114879d372477fa0ea Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 11 Nov 2011 00:19:16 -0800 Subject: [PATCH] Test that `vagrant up` works if Vagrantfile is in a parent directory --- test/acceptance/support/isolated_environment.rb | 7 +++++-- test/acceptance/up_basic_test.rb | 11 ++++++++++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/acceptance/support/isolated_environment.rb b/test/acceptance/support/isolated_environment.rb index b45781596..b08f0fdbf 100644 --- a/test/acceptance/support/isolated_environment.rb +++ b/test/acceptance/support/isolated_environment.rb @@ -54,8 +54,11 @@ module Acceptance def execute(command, *argN) command = replace_command(command) - # Add our hash options to the arguments list - argN << { :chdir => @workdir.to_s } + # Setup the options that will be passed to the ``popen4`` + # method. + argN << {} if !argN.last.is_a?(Hash) + options = argN.last + options[:chdir] ||= @workdir.to_s # Execute in a separate process, wait for it to complete, and # return the IO streams. diff --git a/test/acceptance/up_basic_test.rb b/test/acceptance/up_basic_test.rb index a2f62d638..bf2829412 100644 --- a/test/acceptance/up_basic_test.rb +++ b/test/acceptance/up_basic_test.rb @@ -19,6 +19,16 @@ describe "vagrant up", "basics" do result.stdout.should match_output(:status, "default", "running") end + it "is able to run if Vagrantfile is in a parent directory" do + initialize_valid_environment + + # Create a subdirectory in the working directory and use + # that as the CWD for `vagrant up` and verify it still works + foodir = environment.workdir.join("foo") + foodir.mkdir + assert_execute("vagrant", "up", :chdir => foodir.to_s) + end + it "should have a '/vagrant' shared folder" do initialize_valid_environment @@ -38,7 +48,6 @@ describe "vagrant up", "basics" do TODO: - should "be able to run if `Vagrantfile` is in parent directory" should "destroy a running virtual machine" should "save then restore a virtual machine using `vagrant up`" should "halt then start a virtual machine using `vagrant up`"