Fix failing destroy test for requiring a VM

This commit is contained in:
Mitchell Hashimoto 2011-11-20 13:39:54 -08:00
parent 38d28800be
commit 3a18119774
2 changed files with 15 additions and 1 deletions

View File

@ -4,7 +4,16 @@ require "support/shared/command_examples"
describe "vagrant destroy" do
include_context "acceptance"
it_behaves_like "a command that requires a Vagrantfile", ["vagrant", "destroy"]
it_behaves_like "a command that requires a virtual machine", ["vagrant", "destroy"]
it "succeeds and ignores if the VM is not created" do
require_box("default")
assert_execute("vagrant", "box", "add", "base", box_path("default"))
assert_execute("vagrant", "init")
result = assert_execute("vagrant", "destroy")
result.stdout.should match_output(:vm_not_created_warning)
end
it "is able to destroy a running virtual machine" do
require_box("default")

View File

@ -51,6 +51,11 @@ module Acceptance
@text =~ /^VM must be created/
end
# This checks that the warning that the VM is not created is emitted.
def vm_not_created_warning
@text =~ /VM not created. Moving on...$/
end
# This checks that the VM is destroyed.
def vm_destroyed
@text =~ /Destroying VM and associated drives...$/