Vagrant.config.home now returns nil if home is nil, otherwise expands path
This commit is contained in:
parent
98d8c1978b
commit
39a8a5fd94
|
@ -124,7 +124,7 @@ module Vagrant
|
|||
attr_accessor :home
|
||||
|
||||
def home
|
||||
File.expand_path(@home)
|
||||
@home ? File.expand_path(@home) : nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -187,4 +187,21 @@ class ConfigTest < Test::Unit::TestCase
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
context "vagrant configuration" do
|
||||
setup do
|
||||
@config = Vagrant::Config::VagrantConfig.new
|
||||
end
|
||||
|
||||
should "return nil if home is nil" do
|
||||
File.expects(:expand_path).never
|
||||
assert @config.home.nil?
|
||||
end
|
||||
|
||||
should "expand the path if home is not nil" do
|
||||
@config.home = "foo"
|
||||
File.expects(:expand_path).with("foo").once.returns("result")
|
||||
assert_equal "result", @config.home
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue