kernel_v2: test for box_url

This commit is contained in:
Mitchell Hashimoto 2014-01-24 12:58:01 -08:00
parent 8ab3ae1bef
commit d40ff9c390
3 changed files with 19 additions and 5 deletions

View File

@ -329,9 +329,7 @@ module VagrantPlugins
end end
# Make sure the box URL is an array if it is set # Make sure the box URL is an array if it is set
if @box_url && !@box_url.is_a?(Array) @box_url = Array(@box_url) if @box_url
@box_url = [@box_url]
end
# Set the guest properly # Set the guest properly
@guest = @guest.to_sym if @guest @guest = @guest.to_sym if @guest

View File

@ -1329,7 +1329,6 @@ en:
destroying: "Deleting box '%{name}'..." destroying: "Deleting box '%{name}'..."
download: download:
cleaning: "Cleaning up downloaded box..." cleaning: "Cleaning up downloaded box..."
downloading: "Downloading box from URL: %{url}"
download_failed: |- download_failed: |-
Download failed. Will try another box URL if there is one. Download failed. Will try another box URL if there is one.
interrupted: "Box download was interrupted. Exiting." interrupted: "Box download was interrupted. Exiting."

View File

@ -33,10 +33,27 @@ describe VagrantPlugins::Kernel_V2::VMConfig do
end end
describe "#box_url" do describe "#box_url" do
it "defaults properly" do it "defaults to nil" do
subject.finalize! subject.finalize!
expect(subject.box_url).to be_nil expect(subject.box_url).to be_nil
end end
it "turns into an array" do
subject.box_url = "foo"
subject.finalize!
expect(subject.box_url).to eq(
["foo"])
end
it "keeps in array" do
subject.box_url = ["foo", "bar"]
subject.finalize!
expect(subject.box_url).to eq(
["foo", "bar"])
end
end end
context "#box_version" do context "#box_version" do