From 2b5d24985cfb0ae9c0fc32b53fb4a037864ccf4f Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Mon, 17 Jun 2019 12:11:46 +1000 Subject: [PATCH] feat(webhooks): use consumer/provider names in webhook title --- lib/pact_broker/api/decorators/webhooks_decorator.rb | 2 +- .../pact_broker/api/decorators/webhooks_decorator_spec.rb | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/pact_broker/api/decorators/webhooks_decorator.rb b/lib/pact_broker/api/decorators/webhooks_decorator.rb index 8ea181c07..98cfcfbb5 100644 --- a/lib/pact_broker/api/decorators/webhooks_decorator.rb +++ b/lib/pact_broker/api/decorators/webhooks_decorator.rb @@ -24,7 +24,7 @@ class WebhooksDecorator < BaseDecorator links :'pb:webhooks' do | context | represented.entries.collect do | webhook | { - title: "Webhook", + title: webhook.scope_description, name: webhook.display_description, href: webhook_url(webhook.uuid, context[:base_url]) } diff --git a/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb b/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb index 37a19f71a..1ace0c88c 100644 --- a/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb +++ b/spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb @@ -9,7 +9,8 @@ module Decorators let(:webhook) do instance_double(Domain::Webhook, uuid: 'some-uuid', - display_description: 'description' + display_description: 'description', + scope_description: 'scope description' ) end let(:base_url) { 'http://example.org' } @@ -34,7 +35,7 @@ module Decorators it "includes a list of links to the webhooks" do expect(subject[:_links][:'pb:webhooks']).to be_instance_of(Array) - expect(subject[:_links][:'pb:webhooks'].first).to eq title: 'Webhook', name: 'description', href: 'http://example.org/webhooks/some-uuid' + expect(subject[:_links][:'pb:webhooks'].first).to eq title: 'scope description', name: 'description', href: 'http://example.org/webhooks/some-uuid' end it "includes curies" do