2011-11-05 21:09:18 +00:00
|
|
|
require File.expand_path("../base", __FILE__)
|
|
|
|
|
2011-11-07 07:47:23 +00:00
|
|
|
describe "vagrant init" do
|
|
|
|
include_context "acceptance"
|
|
|
|
|
|
|
|
it "creates a Vagrantfile in the working directory" do
|
|
|
|
vagrantfile = environment.workdir.join("Vagrantfile")
|
2011-11-05 21:09:18 +00:00
|
|
|
assert(!vagrantfile.exist?, "Vagrantfile shouldn't exist")
|
|
|
|
|
|
|
|
result = execute("vagrant", "init")
|
2011-11-09 07:03:15 +00:00
|
|
|
result.should be_success
|
|
|
|
vagrantfile.exist?.should be, "Vagrantfile should exist"
|
2011-11-05 21:09:18 +00:00
|
|
|
end
|
|
|
|
|
2011-11-07 07:47:23 +00:00
|
|
|
it "creates a Vagrantfile with the box set to the given argument" do
|
|
|
|
vagrantfile = environment.workdir.join("Vagrantfile")
|
2011-11-05 21:09:18 +00:00
|
|
|
|
|
|
|
result = execute("vagrant", "init", "foo")
|
2011-11-09 07:03:15 +00:00
|
|
|
result.should be_success
|
|
|
|
vagrantfile.read.should match(/config.vm.box = "foo"$/)
|
2011-11-05 21:09:18 +00:00
|
|
|
end
|
|
|
|
|
2011-11-07 07:47:23 +00:00
|
|
|
it "creates a Vagrantfile with the box URL set to the given argument" do
|
|
|
|
vagrantfile = environment.workdir.join("Vagrantfile")
|
2011-11-05 21:09:18 +00:00
|
|
|
|
|
|
|
result = execute("vagrant", "init", "foo", "bar")
|
2011-11-09 07:03:15 +00:00
|
|
|
result.should be_success
|
2011-11-05 21:09:18 +00:00
|
|
|
|
|
|
|
contents = vagrantfile.read
|
2011-11-09 07:03:15 +00:00
|
|
|
contents.should match(/config.vm.box = "foo"$/)
|
|
|
|
contents.should match(/config.vm.box_url = "bar"$/)
|
2011-11-05 21:09:18 +00:00
|
|
|
end
|
|
|
|
end
|