From d45244f7fec6fa419f3c6fe2faa0b7cc8b80bb5b Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Fri, 15 Jun 2018 12:56:41 +1000 Subject: [PATCH] feat: update expectation of error response --- doc/pacts/markdown/Pact Broker Client - Pact Broker.md | 4 +++- spec/pacts/pact_broker_client-pact_broker.json | 6 ++++-- spec/service_providers/pact_broker_client_publish_spec.rb | 7 ++++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md index 6be11b73..de702c11 100644 --- a/doc/pacts/markdown/Pact Broker Client - Pact Broker.md +++ b/doc/pacts/markdown/Pact Broker Client - Pact Broker.md @@ -1055,7 +1055,9 @@ Pact Broker will respond with: "Content-Type": "application/hal+json" }, "body": { - "message": "An error occurred" + "error": { + "message": "An error occurred" + } } } ``` diff --git a/spec/pacts/pact_broker_client-pact_broker.json b/spec/pacts/pact_broker_client-pact_broker.json index f7846774..9e66ed44 100644 --- a/spec/pacts/pact_broker_client-pact_broker.json +++ b/spec/pacts/pact_broker_client-pact_broker.json @@ -804,14 +804,16 @@ "Content-Type": "application/hal+json" }, "body": { - "message": "An error occurred" + "error": { + "message": "An error occurred" + } }, "matchingRules": { "$.headers.Content-Type": { "match": "regex", "regex": "application\\/.*json" }, - "$.body.message": { + "$.body.error.message": { "match": "regex", "regex": ".*" } diff --git a/spec/service_providers/pact_broker_client_publish_spec.rb b/spec/service_providers/pact_broker_client_publish_spec.rb index 7fdc8fb6..cda1c3b8 100644 --- a/spec/service_providers/pact_broker_client_publish_spec.rb +++ b/spec/service_providers/pact_broker_client_publish_spec.rb @@ -1,3 +1,6 @@ +require 'pact_broker/client/pact_broker_client' +require_relative 'pact_helper' + module PactBroker::Client describe PactBrokerClient, :pact => true do @@ -116,7 +119,9 @@ module PactBroker::Client status: 500, headers: {'Content-Type' => Pact.term(generate: 'application/hal+json', matcher: %r{application/.*json})}, body: { - message: Pact::Term.new(matcher: /.*/, generate: 'An error occurred') + error: { + message: Pact::Term.new(matcher: /.*/, generate: 'An error occurred') + } } ) end