diff --git a/lib/pact_broker/api/decorators/version_decorator.rb b/lib/pact_broker/api/decorators/version_decorator.rb index 27cb31868..389eef31e 100644 --- a/lib/pact_broker/api/decorators/version_decorator.rb +++ b/lib/pact_broker/api/decorators/version_decorator.rb @@ -28,7 +28,7 @@ class VersionDecorator < BaseDecorator link :'pb:tag' do | options | { - href: pacticipant_url(options.fetch(:base_url), represented.pacticipant) + '/tags/{tag}', + href: version_url(options.fetch(:base_url), represented) + '/tags/{tag}', title: "Get, create or delete a tag for this pacticipant version", templated: true } diff --git a/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb b/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb index d85da3f89..4769b47c9 100644 --- a/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb +++ b/spec/lib/pact_broker/api/decorators/version_decorator_spec.rb @@ -42,6 +42,10 @@ module Decorators expect(subject[:_links][:'pb:pacticipant']).to eq title: "Pacticipant", name: "Consumer", href: "http://example.org/pacticipants/Consumer" end + it "includes a link to get, create or delete a tag" do + expect(subject[:_links][:'pb:tag']).to include href: "http://example.org/pacticipants/Consumer/versions/1.2.3/tags/{tag}", templated: true + end + it "includes a list of the tags" do expect(subject[:_embedded][:tags]).to be_instance_of(Array) expect(subject[:_embedded][:tags].first[:name]).to eq "prod"