core: if box is unversioned, check update does nothing

This commit is contained in:
Mitchell Hashimoto 2014-02-03 11:39:03 +01:00
parent 647563edaf
commit 751b4da2c6
2 changed files with 17 additions and 0 deletions

View File

@ -28,7 +28,12 @@ module Vagrant
# message anyways.
raise Errors::BoxOutdatedNoBox, name: machine.config.vm.box
end
box = machine.box
if box.version == "0" && !box.metadata_url
return @app.call(env)
end
constraints = machine.config.vm.box_version
env[:ui].output(I18n.t(

View File

@ -72,6 +72,18 @@ describe Vagrant::Action::Builtin::BoxCheckOutdated do
end
end
context "with a non-versioned box" do
it "does nothing" do
box.stub(metadata_url: nil)
box.stub(version: "0")
app.should_receive(:call).once
box.should_receive(:has_update?).never
subject.call(env)
end
end
context "with a box" do
it "sets env if no update" do
box.should_receive(:has_update?).and_return(nil)