Exception when you attempt to add a box when a V1 box conflicts.
This commit is contained in:
parent
9e33d16ca1
commit
a35f6a175d
|
@ -26,6 +26,8 @@ module Vagrant
|
||||||
# * BoxAlreadyExists - The box you're attempting to add already exists.
|
# * BoxAlreadyExists - The box you're attempting to add already exists.
|
||||||
# * BoxProviderDoesntMatch - If the given box provider doesn't match the
|
# * BoxProviderDoesntMatch - If the given box provider doesn't match the
|
||||||
# actual box provider in the untarred box.
|
# actual box provider in the untarred box.
|
||||||
|
# * BoxUpgradeRequired - You're attempting to add a box when there is a
|
||||||
|
# V1 box with the same name that must first be upgraded.
|
||||||
#
|
#
|
||||||
# Preconditions:
|
# Preconditions:
|
||||||
# * File given in `path` must exist.
|
# * File given in `path` must exist.
|
||||||
|
|
|
@ -37,6 +37,18 @@ describe Vagrant::BoxCollection2 do
|
||||||
to raise_error(Vagrant::Errors::BoxAlreadyExists)
|
to raise_error(Vagrant::Errors::BoxAlreadyExists)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "should raise an exception if you're attempting to add a box that exists as a V1 box" do
|
||||||
|
prev_box_name = "foo"
|
||||||
|
|
||||||
|
# Create the V1 box
|
||||||
|
environment.box1(prev_box_name)
|
||||||
|
|
||||||
|
# Attempt to add some V2 box with the same name
|
||||||
|
box_path = environment.box2_file(:vmware)
|
||||||
|
expect { instance.add(box_path, prev_box_name, :vmware) }.
|
||||||
|
to raise_error(Vagrant::Errors::BoxUpgradeRequired)
|
||||||
|
end
|
||||||
|
|
||||||
it "should raise an exception and not add the box if the provider doesn't match" do
|
it "should raise an exception and not add the box if the provider doesn't match" do
|
||||||
box_name = "foo"
|
box_name = "foo"
|
||||||
good_provider = :virtualbox
|
good_provider = :virtualbox
|
||||||
|
|
Loading…
Reference in New Issue