my_api_client 0.10.1 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b184fa1b59269203a189c396d43f1b9f63e91c38c6402c22ed77ce30c60f78e6
4
- data.tar.gz: 05befe929b0d318c2668dfeb3627602c9985e4da4baf8b5a234469d772da4d78
3
+ metadata.gz: 6b51c7b894daf22bf34e5ee6e578a454a0937baaa65b81b57beef81bbc6987c8
4
+ data.tar.gz: 112cba8ee0ef065e785085add92835cb11a4d09b25337f0af0fc6714c72b138d
5
5
  SHA512:
6
- metadata.gz: b788bb9d4ac50f1c0c31f6d24df04e164fe325173f4ece5a01effb2b5b696ea68c7630b56a4e0f6a1b6e001da2ce46b1e4a568e9110729f75c5b7a5d086a20c0
7
- data.tar.gz: a8d5a2aa67ce54336961ce0a1a79b2461cf38cfa82546f6b9ddbe1f33e09c8bc002aa2cefe2f1f093321d9a6bbaad4003ea5e63c29b4e8858eeb882178cdf7cd
6
+ metadata.gz: f1d8bbf5fbaf7fddb6b862f1f3b16f0747b3f6d67d1c1ab14d3587bffda42357718d029fa96761b8ef3fa69dd6c2e7088fc3e283ad152028d16f66e95411268b
7
+ data.tar.gz: 75f812f2f1d6bc99b9a2c482942c395b4b5ca96d972799013818f08ad1337533b3bcdadb9734a21ca1f323ae420b8b245b81f2261a45534f8dbe7d49473403e0
@@ -1,5 +1,12 @@
1
1
  # Change log
2
2
 
3
+ ## 0.10.2 (Oct 23, 2019)
4
+
5
+ ### Bugfix
6
+
7
+ * Ignore error handling when using request to matcher ([#130](git@github.com:ryz310/my_api_client/pull/130))
8
+ * Fix `be_handled_as_an_error` description ([#131](git@github.com:ryz310/my_api_client/pull/131))
9
+
3
10
  ## 0.10.1 (Oct 23, 2019)
4
11
 
5
12
  ### Feature
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- my_api_client (0.10.1)
4
+ my_api_client (0.10.2)
5
5
  activesupport (>= 4.2.0)
6
6
  jsonpath
7
7
  sawyer (>= 0.8.2)
@@ -21,7 +21,7 @@ RSpec::Matchers.define :be_handled_as_an_error do |expected_error_class|
21
21
  chain :when_receive, :expected_response
22
22
 
23
23
  description do
24
- message = "be handled as #{expected_error_class}"
24
+ message = "be handled as #{expected_error_class || 'an error'}"
25
25
  message += " after retry #{retry_count} times" unless retry_count.nil?
26
26
  message
27
27
  end
@@ -52,7 +52,7 @@ RSpec::Matchers.define :be_handled_as_an_error do |expected_error_class|
52
52
  headers: expected_response[:headers] || {},
53
53
  body: expected_response[:body] || nil
54
54
  )
55
- @sawyer = instance_double(Sawyer::Agent, call: response, sleep: nil)
55
+ @sawyer = instance_double(Sawyer::Agent, call: response)
56
56
  allow(Sawyer::Agent).to receive(:new).and_return(sawyer)
57
57
  end
58
58
 
@@ -27,7 +27,7 @@ RSpec::Matchers.define :request_to do |expected_method, expected_url|
27
27
  query: options[:query],
28
28
  }.compact
29
29
  end.and_return(dummy_response)
30
- api_request.call
30
+ safe_execution(api_request)
31
31
  @expected == @actual
32
32
  end
33
33
 
@@ -44,6 +44,13 @@ RSpec::Matchers.define :request_to do |expected_method, expected_url|
44
44
  MESSAGE
45
45
  end
46
46
 
47
+ # To ignore error handling
48
+ def safe_execution(api_request)
49
+ api_request.call
50
+ rescue MyApiClient::Error
51
+ nil
52
+ end
53
+
47
54
  def request_line(method, url)
48
55
  "#{method.upcase} #{url}"
49
56
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MyApiClient
4
- VERSION = '0.10.1'
4
+ VERSION = '0.10.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: my_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryz310