test: `vagrant up` should fail if no Vagranfile is found

This commit is contained in:
Mitchell Hashimoto 2011-11-06 18:23:06 -08:00
parent a80e579af7
commit e86628c023
2 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,12 @@ module Acceptance
@text =~ /There are no installed boxes!/ @text =~ /There are no installed boxes!/
end 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. # Tests that the output contains a specific Vagrant version.
def is_version?(version) def is_version?(version)
@text =~ /^Vagrant version #{version}$/ @text =~ /^Vagrant version #{version}$/

View File

@ -1,6 +1,13 @@
require File.expand_path("../../base", __FILE__) require File.expand_path("../../base", __FILE__)
class BasicUpTest < AcceptanceTest 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 should "bring up a running virtual machine" do
assert_execute("vagrant", "box", "add", "base", config.boxes["default"]) assert_execute("vagrant", "box", "add", "base", config.boxes["default"])
assert_execute("vagrant", "init") assert_execute("vagrant", "init")
@ -15,7 +22,6 @@ class BasicUpTest < AcceptanceTest
TODO: TODO:
should "fail if no `Vagrantfile` is found"
should "be able to run if `Vagrantfile` is in parent directory" 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 be able to SSH into it"
should "bring up a running virtual machine and have a `/vagrant' shared folder by default" should "bring up a running virtual machine and have a `/vagrant' shared folder by default"