+System.put_env("ENDPOINT_TEST_HOST", "example.com")
+
 defmodule Phoenix.Endpoint.EndpointTest do
   use ExUnit.Case, async: true
   use RouterHelper
 
-  @config [url: [host: "example.com", path: "/api"],
+  @config [url: [host: {:system, "ENDPOINT_TEST_HOST"}, path: "/api"],
            static_url: [host: "static.example.com"],
            server: false, http: [port: 80], https: [port: 443],
            force_ssl: [subdomains: true],


    assert Endpoint.config_change([{Endpoint, config}], []) == :ok
    assert Enum.sort(Endpoint.config(:url)) ==
           [host: "example.com", path: "/", port: 1234]
    assert Enum.sort(Endpoint.config(:static_url)) ==
           [host: "static.example.com", port: 456]
    assert Endpoint.url == "https://example.com:1234"

  end

  test "has reloadable configuration" do
    assert Endpoint.config(:url) == [host: {:system, "ENDPOINT_TEST_HOST"}, path: "/api"]
    assert Endpoint.config(:static_url) == [host: "static.example.com"]
    assert Endpoint.url == "https://example.com"
    assert Endpoint.static_url == "https://static.example.com"
