From 0bcb47a937de5c03b329c5f78dbbbfe142eeebcf Mon Sep 17 00:00:00 2001 From: briri Date: Tue, 11 Jun 2019 15:08:04 -0700 Subject: [PATCH 1/3] stubbed new ror heartbeat check --- spec/mocks/ror.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/spec/mocks/ror.rb b/spec/mocks/ror.rb index 7fd8ea4b..1fb3aaa7 100644 --- a/spec/mocks/ror.rb +++ b/spec/mocks/ror.rb @@ -7,6 +7,17 @@ def mock_ror!(user = nil) stub_ror_id_lookup(university: user.present? && user.affiliation.present? ? user.affiliation.long_name : nil) end + def stub_ror_heartbeat_check + stub_request(:get, "https://api.ror.org/heartbeat") + .with( + headers: { + 'Accept'=>'*/*', + 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'User-Agent'=>'Ruby' + }) + .to_return(status: 200, body: "", headers: {}) + end + # rubocop:disable Metrics/MethodLength def stub_ror_id_lookup(university: Faker::Educator.university, country: 'United States of America') # Mock a request for a specific ROR Organization From b3f7a1bf731ccc5e81f5eeebbb6b417473ff65d7 Mon Sep 17 00:00:00 2001 From: briri Date: Tue, 11 Jun 2019 15:18:40 -0700 Subject: [PATCH 2/3] fixed issue with ror mock --- spec/mocks/ror.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/mocks/ror.rb b/spec/mocks/ror.rb index 1fb3aaa7..4c32f07b 100644 --- a/spec/mocks/ror.rb +++ b/spec/mocks/ror.rb @@ -3,6 +3,7 @@ module Mocks module Ror def mock_ror!(user = nil) + stub_ror_heartbeat_check stub_ror_name_lookup(name: user.present? && user.affiliation.present? ? user.affiliation.long_name : nil) stub_ror_id_lookup(university: user.present? && user.affiliation.present? ? user.affiliation.long_name : nil) end From 77f62a3c6a95abd3f3fa7bf708c1f13281444dab Mon Sep 17 00:00:00 2001 From: briri Date: Tue, 11 Jun 2019 15:27:11 -0700 Subject: [PATCH 3/3] fixed rubocop --- spec/mocks/ror.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/spec/mocks/ror.rb b/spec/mocks/ror.rb index 4c32f07b..7693703f 100644 --- a/spec/mocks/ror.rb +++ b/spec/mocks/ror.rb @@ -9,14 +9,15 @@ def mock_ror!(user = nil) end def stub_ror_heartbeat_check - stub_request(:get, "https://api.ror.org/heartbeat") + stub_request(:get, 'https://api.ror.org/heartbeat') .with( - headers: { - 'Accept'=>'*/*', - 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', - 'User-Agent'=>'Ruby' - }) - .to_return(status: 200, body: "", headers: {}) + headers: { + 'Accept' => '*/*', + 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', + 'User-Agent' => 'Ruby' + } + ) + .to_return(status: 200, body: '', headers: {}) end # rubocop:disable Metrics/MethodLength