diff --git a/lib/vagrant/config.rb b/lib/vagrant/config.rb index 88cf11b23..c64b25c5f 100644 --- a/lib/vagrant/config.rb +++ b/lib/vagrant/config.rb @@ -67,7 +67,7 @@ module Vagrant attr_accessor :private_key_path def private_key_path - File.expand_path(@private_key_path) + File.expand_path(@private_key_path, Env.root_path) end end diff --git a/test/vagrant/config_test.rb b/test/vagrant/config_test.rb index 6e9807fed..83509b59b 100644 --- a/test/vagrant/config_test.rb +++ b/test/vagrant/config_test.rb @@ -3,7 +3,8 @@ require File.join(File.dirname(__FILE__), '..', 'test_helper') class ConfigTest < Test::Unit::TestCase context "the ssh config" do should "expand any path when requesting the value" do - File.stubs(:expand_path).with(Vagrant.config.ssh[:private_key_path]).returns('success') + Vagrant::Env.stubs(:root_path).returns('foo') + File.stubs(:expand_path).with(Vagrant.config.ssh[:private_key_path], 'foo').returns('success') assert Vagrant.config.ssh.private_key_path, 'success' end end