From 6839bb6d85d0004671d9d5ca1f0ab0980375f85d Mon Sep 17 00:00:00 2001 From: Akinori MUSHA Date: Thu, 25 May 2017 06:52:53 +0900 Subject: [PATCH] Update the basic auth mocking for webmock 2 --- spec/models/agents/website_agent_spec.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/models/agents/website_agent_spec.rb b/spec/models/agents/website_agent_spec.rb index afceb250..e746de50 100644 --- a/spec/models/agents/website_agent_spec.rb +++ b/spec/models/agents/website_agent_spec.rb @@ -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