2020-10-10 14:16:11 +02:00
|
|
|
# typed: false
|
2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-04-05 14:48:35 -07:00
|
|
|
require "utils/curl"
|
|
|
|
|
|
|
|
describe "curl" do
|
|
|
|
describe "curl_args" do
|
2020-03-28 19:38:39 +00:00
|
|
|
it "returns --disable as the first argument when HOMEBREW_CURLRC is not set" do
|
|
|
|
# --disable must be the first argument according to "man curl"
|
|
|
|
expect(curl_args("foo").first).to eq("--disable")
|
2018-04-05 14:48:35 -07:00
|
|
|
end
|
2018-04-08 16:07:21 -07:00
|
|
|
|
2020-03-28 19:38:39 +00:00
|
|
|
it "doesn't return --disable as the first argument when HOMEBREW_CURLRC is set" do
|
2018-04-09 15:43:03 -07:00
|
|
|
ENV["HOMEBREW_CURLRC"] = "1"
|
2020-03-28 19:38:39 +00:00
|
|
|
expect(curl_args("foo").first).not_to eq("--disable")
|
2018-04-08 16:07:21 -07:00
|
|
|
end
|
2019-05-17 10:14:54 +01:00
|
|
|
|
2020-03-20 18:14:51 +01:00
|
|
|
it "uses `--retry 3` when HOMEBREW_CURL_RETRIES is unset" do
|
2019-05-17 10:14:54 +01:00
|
|
|
expect(curl_args("foo").join(" ")).to include("--retry 3")
|
|
|
|
end
|
2020-03-20 18:14:51 +01:00
|
|
|
|
|
|
|
it "uses the given value for `--retry` when HOMEBREW_CURL_RETRIES is set" do
|
|
|
|
ENV["HOMEBREW_CURL_RETRIES"] = "10"
|
|
|
|
expect(curl_args("foo").join(" ")).to include("--retry 10")
|
|
|
|
end
|
2018-04-05 14:48:35 -07:00
|
|
|
end
|
|
|
|
end
|