diff options
author | Roman Sandler <rsandler@zendesk.com> | 2016-06-18 18:26:09 +0800 |
---|---|---|
committer | Roman Sandler <rsandler@zendesk.com> | 2016-06-18 18:26:09 +0800 |
commit | cd4aa2d7c4b0d252151aa78addbb40a7a5cb393b (patch) | |
tree | d0ec9f3708d78b1fcbdeb0a86bb002804f66fa9d | |
parent | 75a556a127eb7a1b81e1fe6f7e8560f976ba311d (diff) | |
download | bundler-cd4aa2d7c4b0d252151aa78addbb40a7a5cb393b.tar.gz |
add a test for not logging passwords
-rw-r--r-- | spec/bundler/fetcher/downloader_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/bundler/fetcher/downloader_spec.rb b/spec/bundler/fetcher/downloader_spec.rb index bbed835383..2d784b4421 100644 --- a/spec/bundler/fetcher/downloader_spec.rb +++ b/spec/bundler/fetcher/downloader_spec.rb @@ -224,6 +224,18 @@ describe Bundler::Fetcher::Downloader do expect { subject.request(uri, options) }.to raise_error(Bundler::HTTPError, "Network error while fetching http://www.uri-to-fetch.com/api/v2/endpoint") end + + context "when the there are credentials provided in the request" do + let(:uri) { URI("http://username:password@www.uri-to-fetch.com/api/v2/endpoint") } + before do + allow(net_http_get).to receive(:basic_auth).with("username", "password") + end + + it "should raise a Bundler::HTTPError that doesn't contain the password" do + expect { subject.request(uri, options) }.to raise_error(Bundler::HTTPError, + "Network error while fetching http://username@www.uri-to-fetch.com/api/v2/endpoint") + end + end end context "when error message is about no route to host" do |