gds-api-adapters 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,14 @@ module GdsApi
19
19
  to_return(status: 404,
20
20
  body: "{\"error\": [\"Unrecognised Licence Id: #{identifier}\"]}")
21
21
  end
22
+
23
+ def licence_times_out(identifier)
24
+ stub_request(:get, "#{LICENCE_APPLICATION_ENDPOINT}/api/licence/#{identifier}").to_timeout
25
+ end
26
+
27
+ def licence_returns_error(identifier)
28
+ stub_request(:get, "#{LICENCE_APPLICATION_ENDPOINT}/api/licence/#{identifier}").to_return(status: 500)
29
+ end
22
30
  end
23
31
  end
24
32
  end
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '2.3.0'
2
+ VERSION = '2.4.0'
3
3
  end
@@ -171,4 +171,20 @@ EOS
171
171
  "payment" => "none"
172
172
  }
173
173
  end
174
+
175
+ def test_should_raise_exception_on_timeout
176
+ licence_times_out("866-5-1")
177
+
178
+ assert_raises GdsApi::TimedOutException do
179
+ api.details_for_licence("866-5-1")
180
+ end
181
+ end
182
+
183
+ def test_should_raise_exception_on_api_error
184
+ licence_returns_error("866-5-1")
185
+
186
+ assert_raises GdsApi::HTTPErrorResponse do
187
+ api.details_for_licence("866-5-1")
188
+ end
189
+ end
174
190
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.3.0
5
+ version: 2.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - James Stewart
@@ -203,7 +203,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
203
203
  requirements:
204
204
  - - ">="
205
205
  - !ruby/object:Gem::Version
206
- hash: 524613631546273849
206
+ hash: 1481182554123033119
207
207
  segments:
208
208
  - 0
209
209
  version: "0"
@@ -212,7 +212,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - ">="
214
214
  - !ruby/object:Gem::Version
215
- hash: 524613631546273849
215
+ hash: 1481182554123033119
216
216
  segments:
217
217
  - 0
218
218
  version: "0"