From 27b744f5a80a0ecfb2f5f613fb8516103c5095d4 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 25 Mar 2019 09:16:29 +1100 Subject: [PATCH] feat: update pact with broker for scenario where version does not exist --- .../markdown/Pact Broker Client - Pact Broker.md | 8 ++++---- spec/pacts/pact_broker_client-pact_broker.json | 13 +++++-------- .../pact_broker_client_matrix_spec.rb | 12 ++++++------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md index b3f45902..778d56e3 100644 --- a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +++ b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md @@ -417,14 +417,14 @@ Given **the pact for Foo version 1.2.3 has been verified by Bar version 4.5.6**, Pact Broker will respond with: ```json { - "status": 400, + "status": 200, "headers": { "Content-Type": "application/hal+json;charset=utf-8" }, "body": { - "errors": [ - "an error message" - ] + "summary": { + "reason": "an error message" + } } } ``` diff --git a/spec/pacts/pact_broker_client-pact_broker.json b/spec/pacts/pact_broker_client-pact_broker.json index acf48505..7861ef32 100644 --- a/spec/pacts/pact_broker_client-pact_broker.json +++ b/spec/pacts/pact_broker_client-pact_broker.json @@ -345,20 +345,17 @@ "query": "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=9.9.9&latestby=cvpv" }, "response": { - "status": 400, + "status": 200, "headers": { "Content-Type": "application/hal+json;charset=utf-8" }, "body": { - "errors": [ - "an error message" - ] + "summary": { + "reason": "an error message" + } }, "matchingRules": { - "$.body.errors": { - "min": 1 - }, - "$.body.errors[*].*": { + "$.body.summary.reason": { "match": "type" } } diff --git a/spec/service_providers/pact_broker_client_matrix_spec.rb b/spec/service_providers/pact_broker_client_matrix_spec.rb index b30e1f50..711709eb 100644 --- a/spec/service_providers/pact_broker_client_matrix_spec.rb +++ b/spec/service_providers/pact_broker_client_matrix_spec.rb @@ -95,20 +95,20 @@ module PactBroker::Client query: "q[][pacticipant]=Foo&q[][version]=1.2.3&q[][pacticipant]=Bar&q[][version]=9.9.9&latestby=cvpv" ). will_respond_with( - status: 400, + status: 200, headers: pact_broker_response_headers, body: { - errors: Pact.each_like("an error message") + summary: { + reason: Pact.like("an error message") + } } ) end let(:selectors) { [{ pacticipant: "Foo", version: "1.2.3" }, { pacticipant: "Bar", version: "9.9.9" }] } - it 'raises an error' do - expect { - pact_broker_client.matrix.get(selectors) - }.to raise_error PactBroker::Client::Error, "an error message" + it 'does not raise an error' do + pact_broker_client.matrix.get(selectors) end end