2011-11-07 06:15:59 +00:00
|
|
|
require File.expand_path("../base", __FILE__)
|
2011-12-11 23:53:11 +00:00
|
|
|
require "acceptance/support/shared/command_examples"
|
2011-11-06 21:30:49 +00:00
|
|
|
|
2011-11-07 07:47:23 +00:00
|
|
|
describe "vagrant up", "basics" do
|
2011-11-09 07:03:15 +00:00
|
|
|
include_context "acceptance"
|
2011-11-11 05:54:58 +00:00
|
|
|
it_behaves_like "a command that requires a Vagrantfile", ["vagrant", "up"]
|
2011-11-07 02:23:06 +00:00
|
|
|
|
2011-11-11 08:10:42 +00:00
|
|
|
# This creates an initial environment that is ready for a "vagrant up"
|
|
|
|
def initialize_valid_environment
|
2011-11-13 21:49:21 +00:00
|
|
|
require_box("default")
|
|
|
|
|
|
|
|
assert_execute("vagrant", "box", "add", "base", box_path("default"))
|
2011-11-06 21:30:49 +00:00
|
|
|
assert_execute("vagrant", "init")
|
2011-11-11 08:10:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it "brings up a running virtual machine" do
|
|
|
|
initialize_valid_environment
|
|
|
|
|
2011-11-06 21:30:49 +00:00
|
|
|
assert_execute("vagrant", "up")
|
|
|
|
result = assert_execute("vagrant", "status")
|
2011-11-09 07:03:15 +00:00
|
|
|
result.stdout.should match_output(:status, "default", "running")
|
2011-11-06 21:30:49 +00:00
|
|
|
end
|
|
|
|
|
2011-11-11 08:19:16 +00:00
|
|
|
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
|
|
|
|
|
2011-11-11 08:10:42 +00:00
|
|
|
it "should have a '/vagrant' shared folder" do
|
|
|
|
initialize_valid_environment
|
|
|
|
|
|
|
|
# This is the file that will be created from the VM,
|
|
|
|
# but should then exist on the host machine
|
|
|
|
foofile = environment.workdir.join("foo")
|
|
|
|
|
|
|
|
assert_execute("vagrant", "up")
|
|
|
|
foofile.exist?.should_not be,
|
|
|
|
"'foo' should not exist yet."
|
|
|
|
|
|
|
|
assert_execute("vagrant", "ssh", "-c", "touch /vagrant/foo")
|
|
|
|
foofile.exist?.should be, "'foo' should exist since it was touched in the shared folder"
|
|
|
|
end
|
2011-11-06 21:30:49 +00:00
|
|
|
end
|