diff --git a/lib/vagrant/shared_helpers.rb b/lib/vagrant/shared_helpers.rb index d1ab04053..ab7340fde 100644 --- a/lib/vagrant/shared_helpers.rb +++ b/lib/vagrant/shared_helpers.rb @@ -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. diff --git a/test/unit/vagrant/shared_helpers_test.rb b/test/unit/vagrant/shared_helpers_test.rb index cfa9cc46f..a604314e0 100644 --- a/test/unit/vagrant/shared_helpers_test.rb +++ b/test/unit/vagrant/shared_helpers_test.rb @@ -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")