Update the basic auth mocking for webmock 2

This commit is contained in:
Akinori MUSHA 2017-05-25 06:52:53 +09:00
parent 94c24286ea
commit 6839bb6d85

View file

@ -1312,15 +1312,9 @@ fire: hot
@checker.user = users(:bob)
@checker.save!
case @checker.faraday_backend
when :typhoeus
# Webmock's typhoeus adapter does not read the Authorization
# header: https://github.com/bblimke/webmock/pull/592
stub_request(:any, "www.example.com").
with(headers: { 'Authorization' => "Basic #{['user:pass'].pack('m0')}" })
else
stub_request(:any, "user:pass@www.example.com")
end.to_return(body: File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), status: 200)
stub_request(:any, "www.example.com").
with(basic_auth: ['user', 'pass']).
to_return(body: File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), status: 200)
end
describe "#check" do