Skip to content

Commit 372eaf2

Browse files
committed
Update Faraday version in test headers
Changed the 'User-Agent' header from Faraday v2.1.0 to v2.8.1 in multiple spec files to reflect the updated Faraday version. Also updated expected error in http_client_spec.rb from ConnectionFailed to TimeoutError for improved accuracy in test assertions.
1 parent b060064 commit 372eaf2

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

spec/mailers/notifier_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
require 'spec_helper'
33

44
describe Notifier, type: :mailer do
5-
let(:stub_request_headers) { {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v2.1.0' } }
5+
let(:stub_request_headers) { {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v2.8.1' } }
66
let(:study_statistics_body) {File.read('spec/support/json_data/study_statistics.json') }
77
let(:mailer_stub) { stub_request(:get, 'https://classic.clinicaltrials.gov/api//info/study_statistics?fmt=json').with(headers: stub_request_headers).to_return(:status => 200, :body => study_statistics_body, :headers => {}) }
88
let(:msg) { described_class.send_msg('test@gmail.com', event) }

spec/models/clinical_trials_api_v2_spec.rb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
headers: {
99
'Accept'=>'*/*',
1010
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
11-
'User-Agent'=>'Faraday v2.1.0'
11+
'User-Agent'=>'Faraday v2.8.1'
1212
}).
1313
to_return(status: 200, body: '[{"nctId": "NCT123456", "title": "Sample Study"}]', headers: {})
1414

@@ -27,7 +27,7 @@
2727
headers: {
2828
'Accept'=>'*/*',
2929
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
30-
'User-Agent'=>'Faraday v2.1.0'
30+
'User-Agent'=>'Faraday v2.8.1'
3131
}).
3232
to_return(status: 200, body: '{"nctId": "NCT123456", "title": "Sample Study"}', headers: {})
3333

@@ -44,7 +44,7 @@
4444
headers: {
4545
'Accept'=>'*/*',
4646
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
47-
'User-Agent'=>'Faraday v2.1.0'
47+
'User-Agent'=>'Faraday v2.8.1'
4848
}).
4949
to_return(status: 200, body: '[{"field": "sampleField"}]', headers: {})
5050

@@ -61,7 +61,7 @@
6161
headers: {
6262
'Accept'=>'*/*',
6363
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
64-
'User-Agent'=>'Faraday v2.1.0'
64+
'User-Agent'=>'Faraday v2.8.1'
6565
}).
6666
to_return(status: 200, body: '{"size": 100}', headers: {})
6767

@@ -78,7 +78,7 @@
7878
headers: {
7979
'Accept'=>'*/*',
8080
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
81-
'User-Agent'=>'Faraday v2.1.0'
81+
'User-Agent'=>'Faraday v2.8.1'
8282
}).
8383
to_return(status: 200, body: '{"fieldValues": ["value1", "value2"]}', headers: {})
8484

@@ -96,7 +96,7 @@
9696
headers: {
9797
'Accept'=>'*/*',
9898
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
99-
'User-Agent'=>'Faraday v2.1.0'
99+
'User-Agent'=>'Faraday v2.8.1'
100100
}).
101101
to_return(status: 200, body: "{\"field\": \"#{field}\", \"values\": [\"value1\", \"value2\"]}", headers: {})
102102

@@ -114,7 +114,7 @@
114114
headers: {
115115
'Accept'=>'*/*',
116116
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
117-
'User-Agent'=>'Faraday v2.1.0'
117+
'User-Agent'=>'Faraday v2.8.1'
118118
}).
119119
to_return(status: 200, body: '{"listSizes": [10, 20]}', headers: {})
120120

@@ -132,7 +132,7 @@
132132
headers: {
133133
'Accept'=>'*/*',
134134
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
135-
'User-Agent'=>'Faraday v2.1.0'
135+
'User-Agent'=>'Faraday v2.8.1'
136136
}).
137137
to_return(status: 200, body: "{\"field\": \"#{field}\", \"size\": 5}", headers: {})
138138

spec/models/utils/util_updater_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
require 'rails_helper'
22

33
describe Util::Updater do
4-
let(:stub_request_headers) { {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v2.1.0' } }
4+
let(:stub_request_headers) { {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v2.8.1' } }
55
let(:ctg_api_body) {File.read('spec/support/json_data/ctg_api_all.json') }
66
let(:api_url) { 'https://classic.clinicaltrials.gov/api//query/study_fields?fields=NCTId,StudyFirstPostDate,LastUpdatePostDate&fmt=json&max_rnk=1000&min_rnk=1'}
77
before do

spec/services/http_client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999

100100
expect {
101101
api_client.get(endpoint, params)
102-
}.to raise_error(Faraday::ConnectionFailed) # final error after retries
102+
}.to raise_error(Faraday::TimeoutError) # final error after retries
103103

104104
expect(WebMock).to have_requested(:get, url)
105105
.with(query: params)

0 commit comments

Comments
 (0)