hops-airborne 0.2.16 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb0b2fd1e4a53b993af78cf3a22c35de02d7bcd9f59ab7927bc46e6b4ceddeb7
4
- data.tar.gz: e2c0d3159268bdaae55cf575afc988b4b0bbc29b4c6b16fa65759a15ef832943
3
+ metadata.gz: fdf1ef7572ef317118ca584ecf101d31be80e9bb21c3f95101cc2338f1afd64e
4
+ data.tar.gz: 9da9c825a3e0f5cb1177728dfb940a7c486c9ac2a5d22e1a05ec64faf357cbcd
5
5
  SHA512:
6
- metadata.gz: bbb646be6ccd33956a6f170652522b3e4ee79370cfeca1aebaccc949653d6674020940e6152f9b1d6dc9fb5cb5477771d8e93f58fc3d044df6f530b99d60eec3
7
- data.tar.gz: 97e940080c7db8a175213cdf57c5930dbf5ce5521f4dd487930d22ec576afe35bfb66e8c77062492d11f31b6ed2d19d18d0e49061da38dbc393ea845c8dbab50
6
+ metadata.gz: 1adaad6ea699b981e3a4453407ea0cfb2235aabf17a4378722ab8bfcdc58110bce69797f24f5b8858871129ae7d6a53a0ae5594f354b9868b2aa0565a9efaf4f
7
+ data.tar.gz: e1f3639b7338b6f1d69e651f38e8ca2a45d506abd24cedae118d6288142b7ced307ff2a58abd53e90e42c579e337ed1bbebdb9a365b0cd0f77fc56b0fccacc08
@@ -2,11 +2,11 @@ require 'date'
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'hops-airborne'
5
- s.version = '0.2.16'
5
+ s.version = '0.2.17'
6
6
  s.date = Date.today.to_s
7
7
  s.summary = 'RSpec driven API testing framework - LogicalClocks maintained fork'
8
- s.authors = ['Alex Friedman', 'Seth Pollack', 'Fabio Buso']
9
- s.email = ['fabio@logicalclocks.com']
8
+ s.authors = ['Alex Friedman', 'Seth Pollack', 'Fabio Buso', 'Antonios Kouzoupis']
9
+ s.email = ['fabio@logicalclocks.com', 'antonios@logicalclocks.com']
10
10
  s.require_paths = ['lib']
11
11
  s.files = `git ls-files`.split("\n")
12
12
  s.license = 'MIT'
@@ -29,32 +29,32 @@ module Airborne
29
29
  RSpec.configuration
30
30
  end
31
31
 
32
- def get(url, headers = nil)
33
- @response = make_request(:get, url, headers: headers)
32
+ def get(url, headers = nil, timeout = base_timeout)
33
+ @response = make_request(:get, url, headers: headers, timeout: timeout)
34
34
  end
35
35
 
36
- def post(url, post_body = nil, headers = nil)
37
- @response = make_request(:post, url, body: post_body, headers: headers)
36
+ def post(url, post_body = nil, headers = nil, timeout = base_timeout)
37
+ @response = make_request(:post, url, body: post_body, headers: headers, timeout: timeout)
38
38
  end
39
39
 
40
- def patch(url, patch_body = nil, headers = nil)
41
- @response = make_request(:patch, url, body: patch_body, headers: headers)
40
+ def patch(url, patch_body = nil, headers = nil, timeout = base_timeout)
41
+ @response = make_request(:patch, url, body: patch_body, headers: headers, timeout: timeout)
42
42
  end
43
43
 
44
- def put(url, put_body = nil, headers = nil)
45
- @response = make_request(:put, url, body: put_body, headers: headers)
44
+ def put(url, put_body = nil, headers = nil, timeout = base_timeout)
45
+ @response = make_request(:put, url, body: put_body, headers: headers, timeout: timeout)
46
46
  end
47
47
 
48
- def delete(url, delete_body = nil, headers = nil)
49
- @response = make_request(:delete, url, body: delete_body, headers: headers)
48
+ def delete(url, delete_body = nil, headers = nil, timeout = base_timeout)
49
+ @response = make_request(:delete, url, body: delete_body, headers: headers, timeout: timeout)
50
50
  end
51
51
 
52
- def head(url, headers = nil)
53
- @response = make_request(:head, url, headers: headers)
52
+ def head(url, headers = nil, timeout = base_timeout)
53
+ @response = make_request(:head, url, headers: headers, timeout: timeout)
54
54
  end
55
55
 
56
- def options(url, headers = nil)
57
- @response = make_request(:options, url, headers: headers)
56
+ def options(url, headers = nil, timeout = base_timeout)
57
+ @response = make_request(:options, url, headers: headers, timeout: timeout)
58
58
  end
59
59
 
60
60
  def response
@@ -79,4 +79,8 @@ module Airborne
79
79
  base = Airborne.configuration.base_url || ''
80
80
  base + url
81
81
  end
82
+
83
+ def base_timeout
84
+ Airborne.configuration.timeout || 60
85
+ end
82
86
  end
@@ -4,19 +4,22 @@ module Airborne
4
4
  module RestClientRequester
5
5
  def make_request(method, url, options = {})
6
6
  headers = base_headers.merge(options[:headers] || {})
7
+ timeout = options.fetch(:timeout, 60)
7
8
  res = if method == :post || method == :patch || method == :put
8
9
  begin
9
10
  request_body = options[:body].nil? ? '' : options[:body]
10
11
  request_body = request_body.to_json if options[:body].is_a?(Hash)
11
12
  RestClient::Request.execute(:method => method, :url => get_url(url), :payload => request_body,
12
- :headers => headers , :verify_ssl => Airborne.configuration.verify_ssl)
13
+ :headers => headers , :verify_ssl => Airborne.configuration.verify_ssl,
14
+ :timeout => timeout)
13
15
  rescue RestClient::Exception => e
14
16
  e.response
15
17
  end
16
18
  else
17
19
  begin
18
20
  RestClient::Request.execute(:method => method, :url => get_url(url), :headers => headers,
19
- :verify_ssl => Airborne.configuration.verify_ssl)
21
+ :verify_ssl => Airborne.configuration.verify_ssl,
22
+ :timeout => timeout)
20
23
  rescue RestClient::Exception => e
21
24
  e.response
22
25
  end
@@ -17,11 +17,14 @@ RSpec.configure do |config|
17
17
  config.add_setting :rack_app
18
18
  config.add_setting :requester_type
19
19
  config.add_setting :requester_module
20
+ config.add_setting :timeout, default: 60
20
21
  config.before do |example|
21
22
  config.match_expected = example.metadata[:match_expected].nil? ?
22
23
  Airborne.configuration.match_expected_default? : example.metadata[:match_expected]
23
24
  config.match_actual = example.metadata[:match_actual].nil? ?
24
25
  Airborne.configuration.match_actual_default? : example.metadata[:match_actual]
26
+ config.timeout = example.metadata[:timeout].nil? ?
27
+ Airborne.configuration.timeout? : example.metadata[:timeout]
25
28
  end
26
29
 
27
30
  # Include last since it depends on the configuration already being added
@@ -10,6 +10,7 @@ describe 'client requester' do
10
10
  after do
11
11
  allow(RestClient).to receive(:send).and_call_original
12
12
  Airborne.configure { |config| config.headers = {} }
13
+ Airborne.configure { |config| config.timeout = 123 }
13
14
  end
14
15
 
15
16
  it 'should set :content_type to :json by default' do
@@ -17,7 +18,8 @@ describe 'client requester' do
17
18
 
18
19
  expect(RestClient::Request).to have_received(:execute)
19
20
  .with(:method => :get, :url => 'http://www.example.com/foo',
20
- :headers => { content_type: :json }, :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
21
+ :headers => { content_type: :json }, :verify_ssl => OpenSSL::SSL::VERIFY_NONE,
22
+ :timeout => 60)
21
23
  end
22
24
 
23
25
  it 'should override headers with option[:headers]' do
@@ -26,7 +28,8 @@ describe 'client requester' do
26
28
  expect(RestClient::Request).to have_received(:execute)
27
29
  .with(:method => :get, :url => 'http://www.example.com/foo',
28
30
  :headers => { content_type: 'application/x-www-form-urlencoded' },
29
- :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
31
+ :verify_ssl => OpenSSL::SSL::VERIFY_NONE,
32
+ :timeout => 123)
30
33
  end
31
34
 
32
35
  it 'should override headers with airborne config headers' do
@@ -37,6 +40,7 @@ describe 'client requester' do
37
40
  expect(RestClient::Request).to have_received(:execute)
38
41
  .with(:method => :get, :url => 'http://www.example.com/foo',
39
42
  :headers => { content_type: 'text/plain' },
40
- :verify_ssl => OpenSSL::SSL::VERIFY_NONE)
43
+ :verify_ssl => OpenSSL::SSL::VERIFY_NONE,
44
+ :timeout => 123)
41
45
  end
42
46
  end
@@ -1,6 +1,6 @@
1
1
  require 'coveralls'
2
2
  Coveralls.wear!
3
- require 'airborne'
3
+ require 'hops-airborne'
4
4
  require 'stub_helper'
5
5
 
6
6
  Airborne.configure do |config|
metadata CHANGED
@@ -1,16 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hops-airborne
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Friedman
8
8
  - Seth Pollack
9
9
  - Fabio Buso
10
+ - Antonios Kouzoupis
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
- date: 2019-02-18 00:00:00.000000000 Z
14
+ date: 2019-05-10 00:00:00.000000000 Z
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
16
17
  name: rspec
@@ -111,6 +112,7 @@ dependencies:
111
112
  description:
112
113
  email:
113
114
  - fabio@logicalclocks.com
115
+ - antonios@logicalclocks.com
114
116
  executables: []
115
117
  extensions: []
116
118
  extra_rdoc_files: []
@@ -199,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
199
201
  - !ruby/object:Gem::Version
200
202
  version: '0'
201
203
  requirements: []
202
- rubygems_version: 3.0.2
204
+ rubygems_version: 3.0.3
203
205
  signing_key:
204
206
  specification_version: 4
205
207
  summary: RSpec driven API testing framework - LogicalClocks maintained fork