From ec24e9994914a8d7e1a6ed884a570cef7d7fd068 Mon Sep 17 00:00:00 2001 From: Beth Skurrie Date: Sat, 1 Feb 2020 14:38:17 +1100 Subject: [PATCH] fix: correct URL of tag relation in pacticipant version resource --- lib/pact_broker/api/decorators/version_decorator.rb | 2 +- spec/lib/pact_broker/api/decorators/version_decorator_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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"