Skip to content

Commit 2b5d249

Browse files
committed
feat(webhooks): use consumer/provider names in webhook title
1 parent f4a1b68 commit 2b5d249

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/pact_broker/api/decorators/webhooks_decorator.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class WebhooksDecorator < BaseDecorator
2424
links :'pb:webhooks' do | context |
2525
represented.entries.collect do | webhook |
2626
{
27-
title: "Webhook",
27+
title: webhook.scope_description,
2828
name: webhook.display_description,
2929
href: webhook_url(webhook.uuid, context[:base_url])
3030
}

spec/lib/pact_broker/api/decorators/webhooks_decorator_spec.rb

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module Decorators
99
let(:webhook) do
1010
instance_double(Domain::Webhook,
1111
uuid: 'some-uuid',
12-
display_description: 'description'
12+
display_description: 'description',
13+
scope_description: 'scope description'
1314
)
1415
end
1516
let(:base_url) { 'http://example.org' }
@@ -34,7 +35,7 @@ module Decorators
3435

3536
it "includes a list of links to the webhooks" do
3637
expect(subject[:_links][:'pb:webhooks']).to be_instance_of(Array)
37-
expect(subject[:_links][:'pb:webhooks'].first).to eq title: 'Webhook', name: 'description', href: 'http://example.org/webhooks/some-uuid'
38+
expect(subject[:_links][:'pb:webhooks'].first).to eq title: 'scope description', name: 'description', href: 'http://example.org/webhooks/some-uuid'
3839
end
3940

4041
it "includes curies" do

0 commit comments

Comments
 (0)