From 5b360d0990f0f6fb286dadf65581c345c55d3b32 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Apr 2014 19:50:44 -0700 Subject: [PATCH] core: BoxCollection#find version constraint can benil --- lib/vagrant/box_collection.rb | 2 +- test/unit/vagrant/box_collection_test.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index 5ab5465a0..70bf1befe 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -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 diff --git a/test/unit/vagrant/box_collection_test.rb b/test/unit/vagrant/box_collection_test.rb index ffb475725..cdc8dbe37 100644 --- a/test/unit/vagrant/box_collection_test.rb +++ b/test/unit/vagrant/box_collection_test.rb @@ -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,