diff --git a/lib/vagrant/box.rb b/lib/vagrant/box.rb index e4a265c20..c599e626c 100644 --- a/lib/vagrant/box.rb +++ b/lib/vagrant/box.rb @@ -126,7 +126,7 @@ module Vagrant # # @return [String] def ovf_file - File.join(directory, Vagrant.config.vm.box_ovf) + File.join(directory, env.config.vm.box_ovf) end # Begins the process of adding a box to the vagrant installation. This diff --git a/test/vagrant/box_test.rb b/test/vagrant/box_test.rb index 559e83f27..4c5efa894 100644 --- a/test/vagrant/box_test.rb +++ b/test/vagrant/box_test.rb @@ -112,6 +112,7 @@ class BoxTest < Test::Unit::TestCase context "instance methods" do setup do @box = Vagrant::Box.new + @box.env = mock_environment end should "execute the Add action when add is called" do @@ -141,10 +142,12 @@ class BoxTest < Test::Unit::TestCase context "ovf file" do setup do @box.stubs(:directory).returns("foo") + + @box.env.config.vm.box_ovf = "foo.ovf" end should "be the directory joined with the config ovf file" do - assert_equal File.join(@box.directory, Vagrant.config.vm.box_ovf), @box.ovf_file + assert_equal File.join(@box.directory, @box.env.config.vm.box_ovf), @box.ovf_file end end end