From 160b2c40d0ab182d1c15a1878c5facd67df7cf92 Mon Sep 17 00:00:00 2001 From: Chris Tompkinson Date: Tue, 10 Mar 2020 10:47:18 +0000 Subject: [PATCH] Add covering test for headers --- Library/Homebrew/test/download_strategies_spec.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb index e8b456d226..0d8cc669be 100644 --- a/Library/Homebrew/test/download_strategies_spec.rb +++ b/Library/Homebrew/test/download_strategies_spec.rb @@ -241,6 +241,21 @@ describe CurlDownloadStrategy do subject.fetch end end + + context "with headers set" do + alias_matcher :a_string_matching, :match + + let(:specs) { { headers: ["foo", "bar"]} } + + it "adds the appropriate curl args" do + expect(subject).to receive(:system_command!) { |*, args:, **| + expect(args.each_cons(2).to_a).to include(["--header", "foo"]) + expect(args.each_cons(2).to_a).to include(["--header", "bar"]) + } + + subject.fetch + end + end end describe "#cached_location" do