aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2017-08-22 19:16:41 +0200
committerGitHub2017-08-22 19:16:41 +0200
commit9d6ae89ea329d541103a9629a2f94144b39c6ba6 (patch)
tree4fee0695fcaabcde98858de63712c08ece5b17d0 /Library
parent85fd43d4fe595f73b9168360b4c15a43e1a9debf (diff)
parentc9f4d1c35df6bedc9c6c017a27d618055b5aeeca (diff)
downloadbrew-9d6ae89ea329d541103a9629a2f94144b39c6ba6.tar.bz2
Merge pull request #3074 from CamJN/master
Fix curl --user flag being broken in dc5a2c17
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/download_strategy.rb2
-rw-r--r--Library/Homebrew/test/download_strategies_spec.rb11
2 files changed, 12 insertions, 1 deletions
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 2a8b6e585..adeb0a02a 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -381,7 +381,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
# Curl options to be always passed to curl,
# with raw head calls (`curl --head`) or with actual `fetch`.
def _curl_opts
- return ["--user" << meta.fetch(:user)] if meta.key?(:user)
+ return ["--user", meta.fetch(:user)] if meta.key?(:user)
[]
end
diff --git a/Library/Homebrew/test/download_strategies_spec.rb b/Library/Homebrew/test/download_strategies_spec.rb
index 8c376a649..06d6fa855 100644
--- a/Library/Homebrew/test/download_strategies_spec.rb
+++ b/Library/Homebrew/test/download_strategies_spec.rb
@@ -200,6 +200,17 @@ describe GitDownloadStrategy do
end
end
+describe CurlDownloadStrategy do
+ subject { described_class.new(name, resource) }
+ let(:name) { "foo" }
+ let(:url) { "http://example.com/foo.tar.gz" }
+ let(:resource) { double(Resource, url: url, mirrors: [], specs: { user: "download:123456" }, version: nil) }
+
+ it "parses the opts and sets the corresponding args" do
+ expect(subject.send(:_curl_opts)).to eq(["--user", "download:123456"])
+ end
+end
+
describe DownloadStrategyDetector do
describe "::detect" do
subject { described_class.detect(url) }