Tests for modified 'up' command

This commit is contained in:
Mitchell Hashimoto 2010-02-10 22:26:37 -08:00
parent 45fbac92f9
commit 09bd40c207
1 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class CommandsTest < Test::Unit::TestCase
context "up" do context "up" do
setup do setup do
Vagrant::Env.stubs(:persisted_vm).returns(nil)
Vagrant::VM.stubs(:up) Vagrant::VM.stubs(:up)
end end
@ -18,6 +19,13 @@ class CommandsTest < Test::Unit::TestCase
Vagrant::Commands.up Vagrant::Commands.up
end end
should "error if a persisted VM already exists" do
Vagrant::Env.expects(:persisted_vm).returns(true)
Vagrant::Commands.expects(:error_and_exit).once
Vagrant::VM.expects(:up).never
Vagrant::Commands.up
end
should "call up on VM" do should "call up on VM" do
Vagrant::VM.expects(:up).once Vagrant::VM.expects(:up).once
Vagrant::Commands.up Vagrant::Commands.up