api_recipes 2.7.1 → 2.8.0

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: 3c49acd995e584ae959722b5bccb248e1c532289e0be89ebda5e1f59d6a81e8e
4
- data.tar.gz: 92dbb6ce976e6a22d9f5a8b54e5c0fd62d585afb2b0222fe2cf99f885364d52d
3
+ metadata.gz: b8b743f62651355bb59b3d641637d8df6b28a860d5000a3b684758a7d1de5c47
4
+ data.tar.gz: d2febad009985547a7a148e1b07b193d568b76bd75a2064a9c55257652ce7997
5
5
  SHA512:
6
- metadata.gz: f327fb50389e63e750cc6c349af86ad791b27196da80cd78434afbb050868cd56e0b91e9825abc62d621a8adf1afeb8b18ac1c04b72cfdea99ad516526752726
7
- data.tar.gz: 1763a9298481a31923acd934dde45da4f3e105537e35182f65d189eaa7f0128ebfbb96d7409fbf7c6974d389bb495e07d21edae6cf145c6b011520769ad571c6
6
+ metadata.gz: 6a4b6882211bbae0c27f546267674e501df253eb9a22303fadf0bbf85dfd26a2ada943f813ae1660164c20e3dae68d3afd61caf132e6e40be04bf1f62e9cfcd4
7
+ data.tar.gz: e5429acaf4fbcaa1f5e83090d8ede9dcee36253a61b8d17b5e79fb5c4c4178115b677d91ac39e8c145af63dd1813e904834201fddbc930e45e07b3d8df3455b9
data/lib/api_recipes.rb CHANGED
@@ -58,6 +58,7 @@ module ApiRecipes
58
58
  unless @configuration
59
59
  @configuration = Configuration.new
60
60
  end
61
+
61
62
  @configuration
62
63
  end
63
64
 
@@ -40,9 +40,15 @@ module ApiRecipes
40
40
  end
41
41
 
42
42
  class ResponseCodeNotAsExpected < Exception
43
- def initialize(path, expected_code = nil, response_code = nil, response_body = nil, message: nil)
43
+
44
+ attr_reader :path, :expected_code, :response
45
+
46
+ def initialize(path, expected_code = nil, response = nil, message: nil)
47
+ @path = path
48
+ @expected_code = expected_code
49
+ @response = response
44
50
  unless message
45
- message = "response code for request on route '#{path}' has returned '#{response_code}', but '#{expected_code}' was expected\n\nResponse body:\n #{response_body}"
51
+ message = "response code for request on route '#{@path}' has returned '#{@response.code}', but '#{@expected_code}' was expected\n\nResponse body:\n #{@response.body}"
46
52
  end
47
53
  super(message)
48
54
  end
@@ -76,7 +76,7 @@ module ApiRecipes
76
76
  case attributes[:on_bad_code].to_s
77
77
  when 'ignore'
78
78
  when 'raise'
79
- raise ResponseCodeNotAsExpected.new(path, expected_code, code, @response.body, message: message)
79
+ raise ResponseCodeNotAsExpected.new(path, expected_code, @response, message: message)
80
80
  end
81
81
  end
82
82
  end
@@ -1,3 +1,3 @@
1
1
  module ApiRecipes
2
- VERSION = '2.7.1'.freeze
2
+ VERSION = '2.8.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_recipes
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Verlato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-04 00:00:00.000000000 Z
11
+ date: 2021-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http