Skip to content

Commit 3a9a178

Browse files
committed
feat(pact resource): improve usage of name and title fields
1 parent d5ea068 commit 3a9a178

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

lib/pact_broker/api/decorators/pact_decorator.rb

+5-10
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ def to_hash(options = {})
5656

5757
link :'pb:latest-pact-version' do | options |
5858
{
59-
title: "Pact",
60-
name: "Latest version of this pact",
59+
title: "Latest version of this pact",
6160
href: latest_pact_url(options.fetch(:base_url), represented)
6261

6362
}
@@ -72,33 +71,29 @@ def to_hash(options = {})
7271

7372
link :'pb:latest-untagged-pact-version' do | options |
7473
{
75-
title: "Pact",
76-
name: "Latest untagged version of this pact",
74+
title: "Latest untagged version of this pact",
7775
href: latest_untagged_pact_url(represented, options.fetch(:base_url))
7876
}
7977
end
8078

8179
link :'pb:latest-tagged-pact-version' do | options |
8280
{
83-
title: "Pact",
84-
name: "Latest tagged version of this pact",
81+
title: "Latest tagged version of this pact",
8582
href: "#{latest_pact_url(options.fetch(:base_url), represented)}/{tag}",
8683
templated: true
8784
}
8885
end
8986

9087
link :'pb:previous-distinct' do | options |
9188
{
92-
title: "Pact",
93-
name: "Previous distinct version of this pact",
89+
title: "Previous distinct version of this pact",
9490
href: previous_distinct_pact_version_url(represented, options.fetch(:base_url))
9591
}
9692
end
9793

9894
link :'pb:diff-previous-distinct' do | options |
9995
{
100-
title: "Diff",
101-
name: "Diff with previous distinct version of this pact",
96+
title: "Diff with previous distinct version of this pact",
10297
href: previous_distinct_diff_url(represented, options.fetch(:base_url))
10398

10499
}

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

+3-6
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,12 @@ module Decorators
5353

5454
it "includes a link to the diff with the previous distinct version" do
5555
expect(subject[:_links][:'pb:diff-previous-distinct']).to eq({href: 'http://example.org/pacts/provider/A%20Provider/consumer/A%20Consumer/version/1234/diff/previous-distinct',
56-
title: 'Diff',
57-
name: 'Diff with previous distinct version of this pact'})
56+
title: 'Diff with previous distinct version of this pact'})
5857
end
5958

6059
it "includes a link to the previous distinct pact version" do
6160
expect(subject[:_links][:'pb:previous-distinct']).to eq({href: 'http://example.org/pacts/provider/A%20Provider/consumer/A%20Consumer/version/1234/previous-distinct',
62-
title: 'Pact',
63-
name: 'Previous distinct version of this pact'})
61+
title: 'Previous distinct version of this pact'})
6462
end
6563

6664
it "includes a link to tag this version" do
@@ -80,8 +78,7 @@ module Decorators
8078
end
8179

8280
it "includes a link to the latest pact" do
83-
expect(subject[:_links][:'pb:latest-pact-version'][:title]).to eq "Pact"
84-
expect(subject[:_links][:'pb:latest-pact-version'][:name]).to eq "Latest version of this pact"
81+
expect(subject[:_links][:'pb:latest-pact-version'][:title]).to eq "Latest version of this pact"
8582
expect(subject[:_links][:'pb:latest-pact-version'][:href]).to eq "http://example.org/pacts/provider/A%20Provider/consumer/A%20Consumer/latest"
8683
end
8784

0 commit comments

Comments
 (0)