From ded817a7d0802cc2aafcdbe4bb256698f6868afd Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 21 Jul 2017 15:59:34 +0200 Subject: Refs: #3507@4.5h spec setup and refactoring, using Faraday in worker - Setting up correct headers for the Webmock request (Oh Boy) - Refactoring all Faraday requests into `lib/af83/http_fetcher.rb` - Implementing the Download --- spec/models/organisation_spec.rb | 2 +- spec/models/user_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'spec/models') diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb index 527f71015..1cce7e846 100644 --- a/spec/models/organisation_spec.rb +++ b/spec/models/organisation_spec.rb @@ -17,7 +17,7 @@ describe Organisation, :type => :model do let(:conf) { Rails.application.config.stif_portail_api } before :each do stub_request(:get, "#{conf[:url]}/api/v1/organizations"). - with(headers: { 'Authorization' => "Token token=\"#{conf[:key]}\"" }). + with(stub_headers(authorization_token: conf[:key])). to_return(body: File.open(File.join(Rails.root, 'spec', 'fixtures', 'organizations.json')), status: 200) end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 6f98e5ce7..c21e7e6d0 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -69,7 +69,7 @@ describe User, :type => :model do let(:conf) { Rails.application.config.stif_portail_api } before :each do stub_request(:get, "#{conf[:url]}/api/v1/users"). - with(headers: { 'Authorization' => "Token token=\"#{conf[:key]}\"" }). + with(stub_headers(authorization_token: conf[:key])). to_return(body: File.open(File.join(Rails.root, 'spec', 'fixtures', 'users.json')), status: 200) end -- cgit v1.2.3