From e86628c023b050db4b27484457a0abbb17f26f61 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 6 Nov 2011 18:23:06 -0800 Subject: [PATCH] test: `vagrant up` should fail if no Vagranfile is found --- test/acceptance/helpers/output.rb | 6 ++++++ test/acceptance/up/basic_test.rb | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/test/acceptance/helpers/output.rb b/test/acceptance/helpers/output.rb index 524bfb98e..75ff7e074 100644 --- a/test/acceptance/helpers/output.rb +++ b/test/acceptance/helpers/output.rb @@ -28,6 +28,12 @@ module Acceptance @text =~ /There are no installed boxes!/ end + # Tests that the output says there is no Vagrantfile, and as such + # can't do whatever we requested Vagrant to do. + def no_vagrantfile + @text =~ /^No Vagrant environment detected/ + end + # Tests that the output contains a specific Vagrant version. def is_version?(version) @text =~ /^Vagrant version #{version}$/ diff --git a/test/acceptance/up/basic_test.rb b/test/acceptance/up/basic_test.rb index a082c9a17..729bf14cb 100644 --- a/test/acceptance/up/basic_test.rb +++ b/test/acceptance/up/basic_test.rb @@ -1,6 +1,13 @@ require File.expand_path("../../base", __FILE__) class BasicUpTest < AcceptanceTest + should "fail if not Vagrantfile is found" do + result = execute("vagrant", "up") + assert(!result.success?, "vagrant up should fail") + assert(output(result.stdout).no_vagrantfile, + "Vagrant should error since there is no Vagrantfile") + end + should "bring up a running virtual machine" do assert_execute("vagrant", "box", "add", "base", config.boxes["default"]) assert_execute("vagrant", "init") @@ -15,7 +22,6 @@ class BasicUpTest < AcceptanceTest TODO: - should "fail if no `Vagrantfile` is found" should "be able to run if `Vagrantfile` is in parent directory" should "bring up a running virtual machine and be able to SSH into it" should "bring up a running virtual machine and have a `/vagrant' shared folder by default"