Box add checks if box exists before the download [closes GH-170]
This commit is contained in:
parent
61314c5e21
commit
3e54150f71
|
@ -1,5 +1,6 @@
|
|||
## 0.6.4 (unreleased)
|
||||
|
||||
- Box add checks if a box already exists before the download. [GH-170]
|
||||
- NFS no longer attempts to clean exports file if VM is not created,
|
||||
which was causing a stack trace during recovery. [related to GH-166]
|
||||
- Basic validation added for Chef configuration (both solo and server).
|
||||
|
|
|
@ -57,6 +57,7 @@ module Vagrant
|
|||
# method requires that `name` and `uri` be set. The logic of this method
|
||||
# is kicked out to the `box_add` registered middleware.
|
||||
def add
|
||||
raise Errors::BoxAlreadyExists.new(:name => name) if File.directory?(directory)
|
||||
env.actions.run(:box_add, { "box" => self })
|
||||
end
|
||||
|
||||
|
|
|
@ -27,6 +27,14 @@ class BoxTest < Test::Unit::TestCase
|
|||
@box = Vagrant::Box.new(vagrant_env, "foo")
|
||||
end
|
||||
|
||||
should "raise an exception if a box exists with the name we're attempting to add" do
|
||||
vagrant_box(@box.name)
|
||||
|
||||
assert_raises(Vagrant::Errors::BoxAlreadyExists) {
|
||||
@box.add
|
||||
}
|
||||
end
|
||||
|
||||
should "execute the Add action when add is called" do
|
||||
@box.env.actions.expects(:run).with(:box_add, { "box" => @box })
|
||||
@box.add
|
||||
|
|
Loading…
Reference in New Issue