From 3e36b4ce12ab6575bf0fecec851208950331d313 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 19 Apr 2010 14:21:21 -0700 Subject: [PATCH] Box verification uses the runner rather than the env --- lib/vagrant/actions/box/verify.rb | 3 ++- test/vagrant/actions/box/verify_test.rb | 9 +++------ vagrant.gemspec | 5 ++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/vagrant/actions/box/verify.rb b/lib/vagrant/actions/box/verify.rb index a4e6ffba6..9838994be 100644 --- a/lib/vagrant/actions/box/verify.rb +++ b/lib/vagrant/actions/box/verify.rb @@ -6,6 +6,7 @@ module Vagrant # the box is assumed to be valid. class Verify < Base def execute! + logger.info "Verifying box..." reload_configuration verify_appliance end @@ -21,7 +22,7 @@ module Vagrant def verify_appliance # We now try to read the applince. If it succeeds, we return true. - VirtualBox::Appliance.new(@runner.env.box.ovf_file) + VirtualBox::Appliance.new(@runner.ovf_file) true rescue VirtualBox::Exceptions::FileErrorException false diff --git a/test/vagrant/actions/box/verify_test.rb b/test/vagrant/actions/box/verify_test.rb index 29d0b0399..1350ad240 100644 --- a/test/vagrant/actions/box/verify_test.rb +++ b/test/vagrant/actions/box/verify_test.rb @@ -28,19 +28,16 @@ class VerifyBoxActionTest < Test::Unit::TestCase context "verifying appliance" do setup do - @box = mock("box") - @box.stubs(:ovf_file).returns("foo") - - @runner.env.stubs(:box).returns(@box) + @runner.stubs(:ovf_file).returns("foo") end should "create new appliance and return true if succeeds" do - VirtualBox::Appliance.expects(:new).with(@box.ovf_file) + VirtualBox::Appliance.expects(:new).with(@runner.ovf_file) assert @action.verify_appliance end should "return false if an exception is raised" do - VirtualBox::Appliance.expects(:new).with(@box.ovf_file).raises(VirtualBox::Exceptions::FileErrorException) + VirtualBox::Appliance.expects(:new).with(@runner.ovf_file).raises(VirtualBox::Exceptions::FileErrorException) assert !@action.verify_appliance end end diff --git a/vagrant.gemspec b/vagrant.gemspec index bf151d12c..1959c3370 100644 --- a/vagrant.gemspec +++ b/vagrant.gemspec @@ -9,7 +9,7 @@ Gem::Specification.new do |s| s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["Mitchell Hashimoto", "John Bender"] - s.date = %q{2010-04-15} + s.date = %q{2010-04-19} s.default_executable = %q{vagrant} s.description = %q{Vagrant is a tool for building and distributing virtualized development environments.} s.email = ["mitchell.hashimoto@gmail.com", "john.m.bender@gmail.com"] @@ -38,6 +38,7 @@ Gem::Specification.new do |s| "lib/vagrant/actions/box/destroy.rb", "lib/vagrant/actions/box/download.rb", "lib/vagrant/actions/box/unpackage.rb", + "lib/vagrant/actions/box/verify.rb", "lib/vagrant/actions/collection.rb", "lib/vagrant/actions/runner.rb", "lib/vagrant/actions/vm/boot.rb", @@ -107,6 +108,7 @@ Gem::Specification.new do |s| "test/vagrant/actions/box/destroy_test.rb", "test/vagrant/actions/box/download_test.rb", "test/vagrant/actions/box/unpackage_test.rb", + "test/vagrant/actions/box/verify_test.rb", "test/vagrant/actions/collection_test.rb", "test/vagrant/actions/runner_test.rb", "test/vagrant/actions/vm/boot_test.rb", @@ -176,6 +178,7 @@ Gem::Specification.new do |s| "test/vagrant/actions/box/destroy_test.rb", "test/vagrant/actions/box/download_test.rb", "test/vagrant/actions/box/unpackage_test.rb", + "test/vagrant/actions/box/verify_test.rb", "test/vagrant/actions/collection_test.rb", "test/vagrant/actions/runner_test.rb", "test/vagrant/actions/vm/boot_test.rb",