core: BoxCollection#find version constraint can benil

This commit is contained in:
Mitchell Hashimoto 2014-04-02 19:50:44 -07:00
parent d1caf8c624
commit 5b360d0990
2 changed files with 13 additions and 1 deletions

View File

@ -256,7 +256,7 @@ module Vagrant
providers = Array(providers)
# Build up the requirements we have
requirements = version.split(",").map do |v|
requirements = version.to_s.split(",").map do |v|
Gem::Requirement.new(v.strip)
end

View File

@ -59,6 +59,18 @@ describe Vagrant::BoxCollection do
expect(result.metadata_url).to be_nil
end
it "returns a box if the box does exist, with no constraints" do
# Create the "box"
environment.box3("foo", "0", :virtualbox)
# Actual test
result = subject.find("foo", :virtualbox, nil)
expect(result).to_not be_nil
expect(result).to be_kind_of(box_class)
expect(result.name).to eq("foo")
expect(result.metadata_url).to be_nil
end
it "sets a metadata URL if it has one" do
# Create the "box"
environment.box3("foo", "0", :virtualbox,