BaseVMNotFoundError -> BaseVMNotFound and test [closes GH-200]
This commit is contained in:
parent
9e7ed2cfe5
commit
8bff03fb80
|
@ -16,7 +16,7 @@ module Vagrant
|
|||
|
||||
def package_base
|
||||
vm = VM.find(options[:base], env)
|
||||
raise Errors::BaseVMNotFoundError.new(:name => options[:base]) if !vm.created?
|
||||
raise Errors::BaseVMNotFound.new(:name => options[:base]) if !vm.created?
|
||||
package_vm(vm)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
require "test_helper"
|
||||
|
||||
class CommandPackageCommandTest < Test::Unit::TestCase
|
||||
setup do
|
||||
@klass = Vagrant::Command::PackageCommand
|
||||
@env = vagrant_env
|
||||
end
|
||||
|
||||
def command(args, opts, env)
|
||||
@klass.new(args, opts, { :env => env })
|
||||
end
|
||||
|
||||
context "initialization" do
|
||||
should "require an environment" do
|
||||
assert_raises(Vagrant::Errors::CLIMissingEnvironment) { command([], {}, nil) }
|
||||
assert_nothing_raised { command([], {}, @env) }
|
||||
end
|
||||
end
|
||||
|
||||
should "raise an exception if VM for supplied base option is not found" do
|
||||
Vagrant::VM.stubs(:find).returns(Vagrant::VM.new(nil))
|
||||
|
||||
assert_raises(Vagrant::Errors::BaseVMNotFound) {
|
||||
command([], { :base => "foo" }, @env).execute
|
||||
}
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue