Skip to content

Commit

Permalink
fix: correct URL of tag relation in pacticipant version resource
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Feb 1, 2020
1 parent a6c54fb commit ec24e99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/pact_broker/api/decorators/version_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions spec/lib/pact_broker/api/decorators/version_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ec24e99

Please sign in to comment.