diff --git a/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb b/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb index 3c38aa177..47aba5a2e 100644 --- a/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb +++ b/lib/pact_broker/api/decorators/webhook_execution_result_decorator.rb @@ -60,6 +60,8 @@ def body property :request, :extend => HTTPRequestDecorator property :response, :extend => HTTPResponseDecorator, if: lambda { |context| context[:options][:user_options][:show_response] } property :response_hidden_message, as: :message, exec_context: :decorator, if: lambda { |context| !context[:options][:user_options][:show_response] } + property :logs + property :success?, as: :success link :webhook do | options | if options.fetch(:webhook).uuid diff --git a/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb b/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb index 88f1fef92..85766cd41 100644 --- a/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb +++ b/spec/lib/pact_broker/api/decorators/webhook_execution_result_decorator_spec.rb @@ -5,10 +5,8 @@ module PactBroker module Api module Decorators describe WebhookExecutionResultDecorator do - describe "to_json" do - - let(:webhook_execution_result) { PactBroker::Webhooks::WebhookExecutionResult.new(request, response, logs, error)} + let(:webhook_execution_result) { PactBroker::Webhooks::WebhookExecutionResult.new(request, response, logs, error) } let(:logs) { "logs" } let(:headers) { { "Something" => ["blah", "thing"]} } let(:request) do @@ -34,6 +32,14 @@ module Decorators expect(subject[:_links][:'try-again'][:href]).to eq 'http://resource-url' end + it "includes a success flag" do + expect(subject[:success]).to be true + end + + it "includes the logs" do + expect(subject[:logs]).to eq logs + end + context "when there is a uuid" do it "include a link to the webhook" do expect(subject[:_links][:webhook][:href]).to eq 'http://example.org/webhooks/some-uuid' @@ -48,7 +54,6 @@ module Decorators end end - context "when there is an error" do let(:error) { double('error', message: 'message', backtrace: ['blah','blah']) }