Skip to content

Commit

Permalink
core: BoxCollection#find version constraint can benil
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Apr 3, 2014
1 parent d1caf8c commit 5b360d0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/vagrant/box_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def find(name, providers, version)
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

Expand Down
12 changes: 12 additions & 0 deletions test/unit/vagrant/box_collection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@
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,
Expand Down

0 comments on commit 5b360d0

Please sign in to comment.