gds-api-adapters 37.5.0 → 37.5.1

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
  SHA1:
3
- metadata.gz: a6605bc5855ecb13e79667aa0b469918b57c1f69
4
- data.tar.gz: 7ec49def047a41ac5278175bc0b0f54bdae69be7
3
+ metadata.gz: dd0e04ee1ee9e50c2462313ec3d6ef71ff0ed84b
4
+ data.tar.gz: b6f932bf549ea2810a9076d3e4fd24ba72e436f3
5
5
  SHA512:
6
- metadata.gz: 210882ae9dc87120936a8842cf3495fd154670dd97d52de27012044947f4346a30a5147ae7d77cc28525c14d7399c8c7f40c5a50b49ed27a77331c778557c37f
7
- data.tar.gz: f080ccb5851c2594effa49897c9023f1ea7ee37121383ee7f4dbeef40c172c5ae4e1718a0b15b7203aa322554f06342a06cb92edb8d60661dc04ab88f7723b20
6
+ metadata.gz: cb524b8dc79496b41421261d60e2f219813654f07ffb0a470fc8b22c21b21b01f9fdbfafd09cf76ec26df94521dab71cfd0e2025777cd640916066e35828a056
7
+ data.tar.gz: 787a2686e3065dbb6f83c2814b22234a995fb5684b8f7e7398b1760d9527270d990bb167198c51e00b2482d41a8bee03dfa5be48bddeb2c07053253b57e6bce5
@@ -25,7 +25,7 @@ module GdsApi
25
25
  extend Forwardable
26
26
  include Enumerable
27
27
 
28
- def_delegators :to_hash, :[], :"<=>", :each
28
+ def_delegators :to_hash, :[], :"<=>", :each, :dig
29
29
 
30
30
  def initialize(http_response, options = {})
31
31
  @http_response = http_response
@@ -1,3 +1,3 @@
1
1
  module GdsApi
2
- VERSION = '37.5.0'.freeze
2
+ VERSION = '37.5.1'.freeze
3
3
  end
@@ -120,15 +120,12 @@ describe GdsApi::PublishingApiV2 do
120
120
  )
121
121
  .will_respond_with(
122
122
  status: 422,
123
- body: {
124
- "error" => {
125
- "code" => 422,
126
- "message" => Pact.term(generate: "Unprocessable entity", matcher:/\S+/),
127
- "fields" => {
128
- "base_path" => Pact.each_like("is invalid", :min => 1),
129
- },
130
- },
131
- },
123
+ body: [
124
+ {
125
+ fragment: "#/base_path",
126
+ failed_attribute: "Pattern"
127
+ }
128
+ ],
132
129
  headers: {
133
130
  "Content-Type" => "application/json; charset=utf-8"
134
131
  }
@@ -136,18 +133,23 @@ describe GdsApi::PublishingApiV2 do
136
133
  end
137
134
 
138
135
  it "responds with 422 Unprocessable Entity" do
139
- error = assert_raises GdsApi::HTTPClientError do
136
+ assert_raises GdsApi::HTTPClientError do
140
137
  @api_client.put_content(@content_id, @content_item)
141
138
  end
142
- assert_equal 422, error.code
143
- assert_equal "Unprocessable entity", error.error_details["error"]["message"]
144
139
  end
145
140
  end
146
141
 
147
142
  describe "optimistic locking" do
148
143
  describe "if the content item has not changed since it was requested" do
149
144
  before do
150
- @content_item = content_item_for_content_id(@content_id, "previous_version" => 3)
145
+ @content_item = content_item_for_content_id(@content_id,
146
+ "document_type" => "manual",
147
+ "schema_name" => "manual",
148
+ "locale" => "en",
149
+ "details" => { "body" => [] },
150
+ "previous_version" => "3"
151
+ )
152
+ @content_item.delete("format")
151
153
 
152
154
  publishing_api
153
155
  .given("the content item #{@content_id} is at version 3")
@@ -173,7 +175,14 @@ describe GdsApi::PublishingApiV2 do
173
175
 
174
176
  describe "if the content item has changed in the meantime" do
175
177
  before do
176
- @content_item = content_item_for_content_id(@content_id, "previous_version" => 2)
178
+ @content_item = content_item_for_content_id(@content_id,
179
+ "document_type" => "manual",
180
+ "schema_name" => "manual",
181
+ "locale" => "en",
182
+ "details" => { "body" => [] },
183
+ "previous_version" => "2"
184
+ )
185
+ @content_item.delete("format")
177
186
 
178
187
  publishing_api
179
188
  .given("the content item #{@content_id} is at version 3")
@@ -236,6 +236,11 @@ describe GdsApi::Response do
236
236
  JSON.expects(:parse).never
237
237
  assert_equal "VAT rates", @response["title"]
238
238
  end
239
+
240
+ it "should allow using dig to access nested keys" do
241
+ skip unless RUBY_VERSION > "2.3"
242
+ assert_equal "1870", @response.dig("details", "need_id")
243
+ end
239
244
  end
240
245
 
241
246
  # TODO: When we remove `GdsApi.config.hash_response_for_requests`, this
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gds-api-adapters
3
3
  version: !ruby/object:Gem::Version
4
- version: 37.5.0
4
+ version: 37.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Stewart