Skip to content

Commit

Permalink
feat: add latest provider version tag names to dashboard UI
Browse files Browse the repository at this point in the history
  • Loading branch information
bethesque committed Jan 25, 2018
1 parent a3aea48 commit de179d7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
9 changes: 9 additions & 0 deletions lib/pact_broker/ui/view_models/index_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ def tag_names
@relationship.tag_names.any? ? " (#{latest_overall}latest #{@relationship.tag_names.join(', ')}) ": " (latest) "
end

def verification_tag_names
if @relationship.latest_verification_latest_tags.any?
tag_names = @relationship.latest_verification_latest_tags.collect(&:name)
" (latest #{tag_names.join(', ')})"
else
""
end
end

def consumer_group_url
Helpers::URLHelper.group_url consumer_name
end
Expand Down
2 changes: 2 additions & 0 deletions lib/pact_broker/ui/views/index/show-with-tags.haml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
= index_item.provider_name
%td.provider-version-number
= index_item.provider_version_number
%span{style: 'color:gray'}
= index_item.verification_tag_names
%td
= index_item.publication_date_of_latest_pact.gsub("about ", "")
%td{ class: index_item.webhook_status }
Expand Down
13 changes: 12 additions & 1 deletion spec/lib/pact_broker/ui/view_models/index_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ module ViewDomain
let(:provider) { instance_double("PactBroker::Domain::Pacticipant", name: 'Provider Name')}
let(:latest_pact) { instance_double("PactBroker::Domain::Pact") }
let(:latest_verification) { instance_double("PactBroker::Domain::Verification") }
let(:domain_relationship) { PactBroker::Domain::IndexItem.new(consumer, provider, latest_pact, latest, latest_verification, [], [], tags)}
let(:domain_relationship) { PactBroker::Domain::IndexItem.new(consumer, provider, latest_pact, latest, latest_verification, [], [], tags, latest_verification_latest_tags)}
let(:tags) { [] }
let(:verification_tag_1) { instance_double("PactBroker::Tags::TagWithLatestFlag", name: 'dev') }
let(:verification_tag_2) { instance_double("PactBroker::Tags::TagWithLatestFlag", name: 'prod') }
let(:latest_verification_latest_tags) { [verification_tag_1, verification_tag_2] }
let(:latest) { true }

subject { IndexItem.new(domain_relationship) }
Expand Down Expand Up @@ -125,7 +128,15 @@ module ViewDomain
let(:tags) { ["master", "prod"] }
its(:tag_names) { is_expected.to eq " (latest master, prod) " }
end
end

describe "verification_tag_names" do
its(:verification_tag_names) { is_expected.to eq " (latest dev, prod)"}

context "when there are no tags" do
let(:latest_verification_latest_tags) { [] }
its(:verification_tag_names) { is_expected.to eq "" }
end
end

describe "<=>" do
Expand Down

0 comments on commit de179d7

Please sign in to comment.