core: Add the default server URL

This commit is contained in:
Mitchell Hashimoto 2014-02-05 14:59:22 -08:00
parent eab1d1150a
commit cac0fdb490
2 changed files with 15 additions and 2 deletions

View File

@ -1,6 +1,13 @@
require "pathname"
module Vagrant
# This is the default endpoint of the Vagrant Cloud in
# use. API calls will be made to this for various functions
# of Vagrant that may require remote access.
#
# @return [String]
DEFAULT_SERVER_URL = "http://www.vagrantcloud.com"
# This returns whether or not 3rd party plugins should be loaded.
#
# @return [Boolean]
@ -12,8 +19,7 @@ module Vagrant
#
# @return [String]
def self.server_url
# TODO: default
ENV["VAGRANT_SERVER_URL"]
ENV["VAGRANT_SERVER_URL"] || DEFAULT_SERVER_URL
end
# The source root is the path to the root directory of the Vagrant source.

View File

@ -23,6 +23,13 @@ describe Vagrant do
end
describe "#server_url" do
it "defaults to the default value" do
with_temp_env("VAGRANT_SERVER_URL" => nil) 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")