Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
Merge pull request #115 from CDL-Dryad/status_dashboard
Browse files Browse the repository at this point in the history
Add ROR heartbeat check stub to Rspec mocks
  • Loading branch information
ryscher authored Jun 12, 2019
2 parents 3eaf614 + 77f62a3 commit 5bf1120
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions spec/mocks/ror.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,23 @@ 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

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
Expand Down

0 comments on commit 5bf1120

Please sign in to comment.