core: Vagrant.server_url should default if empty

This commit is contained in:
Mitchell Hashimoto 2014-02-25 21:39:05 -08:00
parent 56ed5ef4cb
commit b8676a65dd
2 changed files with 10 additions and 1 deletions

View File

@ -19,7 +19,9 @@ module Vagrant
#
# @return [String]
def self.server_url
ENV["VAGRANT_SERVER_URL"] || DEFAULT_SERVER_URL
result = ENV["VAGRANT_SERVER_URL"]
result = nil if result == ""
result || DEFAULT_SERVER_URL
end
# The source root is the path to the root directory of the Vagrant source.

View File

@ -30,6 +30,13 @@ describe Vagrant do
end
end
it "defaults if the string is empty" do
with_temp_env("VAGRANT_SERVER_URL" => "") do
expect(subject.server_url).to eq(
Vagrant::DEFAULT_SERVER_URL)
end
end
it "is the VAGRANT_SERVER_URL value" do
with_temp_env("VAGRANT_SERVER_URL" => "foo") do
expect(subject.server_url).to eq("foo")