From e109a8cd52b34633a94e6c7375c033f8b061cb28 Mon Sep 17 00:00:00 2001 From: Nenad Stojanovikj Date: Tue, 22 Oct 2019 00:40:22 +0200 Subject: [PATCH] fix(frontend): remove 'v' prefix on versions during render (#313) This prevents confusion when looking at versions in the frontend, and seeing things like `vv1.0.0` or `vfd1245b` where the first 'v' is artificially added. --- lib/pact_broker/domain/pact.rb | 2 +- lib/pact_broker/matrix/row.rb | 2 +- lib/pact_broker/ui/view_models/index_item.rb | 6 +++--- spec/lib/pact_broker/pacts/diff_spec.rb | 4 ++-- spec/lib/pact_broker/ui/view_models/index_item_spec.rb | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pact_broker/domain/pact.rb b/lib/pact_broker/domain/pact.rb index 5bccff880..7704679e4 100644 --- a/lib/pact_broker/domain/pact.rb +++ b/lib/pact_broker/domain/pact.rb @@ -47,7 +47,7 @@ def to_json options = {} end def name - "Pact between #{consumer.name} (v#{consumer_version_number}) and #{provider.name}" + "Pact between #{consumer.name} (#{consumer_version_number}) and #{provider.name}" end def version_and_updated_date diff --git a/lib/pact_broker/matrix/row.rb b/lib/pact_broker/matrix/row.rb index dfde836f5..adc6b7551 100644 --- a/lib/pact_broker/matrix/row.rb +++ b/lib/pact_broker/matrix/row.rb @@ -215,7 +215,7 @@ def compare_name_asc name1, name2 end def to_s - "#{consumer_name} v#{consumer_version_number} #{provider_name} #{provider_version_number} #{success}" + "#{consumer_name} #{consumer_version_number} #{provider_name} #{provider_version_number} #{success}" end def compare_number_desc number1, number2 diff --git a/lib/pact_broker/ui/view_models/index_item.rb b/lib/pact_broker/ui/view_models/index_item.rb index ec765dfc2..24bed66a2 100644 --- a/lib/pact_broker/ui/view_models/index_item.rb +++ b/lib/pact_broker/ui/view_models/index_item.rb @@ -151,11 +151,11 @@ def warning? def verification_tooltip case @relationship.pseudo_branch_verification_status when :success - "Successfully verified by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)})" + "Successfully verified by #{provider_name} (#{short_version_number(@relationship.latest_verification_provider_version_number)})" when :stale - "Pact has changed since last successful verification by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)})" + "Pact has changed since last successful verification by #{provider_name} (#{short_version_number(@relationship.latest_verification_provider_version_number)})" when :failed - "Verification by #{provider_name} (v#{short_version_number(@relationship.latest_verification_provider_version_number)}) failed" + "Verification by #{provider_name} (#{short_version_number(@relationship.latest_verification_provider_version_number)}) failed" else nil end diff --git a/spec/lib/pact_broker/pacts/diff_spec.rb b/spec/lib/pact_broker/pacts/diff_spec.rb index 914f3409f..49eef31ac 100644 --- a/spec/lib/pact_broker/pacts/diff_spec.rb +++ b/spec/lib/pact_broker/pacts/diff_spec.rb @@ -59,8 +59,8 @@ module Pacts subject { Diff.new.process(pact_params.merge(base_url: 'http://example.org'), comparison_pact_params) } it "compares the two pacts" do - expect(subject).to include "Pact between Consumer (v3) and Provider" - expect(subject).to include "Pact between Consumer (v4) and Provider" + expect(subject).to include "Pact between Consumer (3) and Provider" + expect(subject).to include "Pact between Consumer (4) and Provider" end it "includes a link to the comparison pact", pending: true do diff --git a/spec/lib/pact_broker/ui/view_models/index_item_spec.rb b/spec/lib/pact_broker/ui/view_models/index_item_spec.rb index 3d5cb8603..6ac91283b 100644 --- a/spec/lib/pact_broker/ui/view_models/index_item_spec.rb +++ b/spec/lib/pact_broker/ui/view_models/index_item_spec.rb @@ -52,21 +52,21 @@ module ViewDomain let(:pseudo_branch_verification_status) { :stale } its(:pseudo_branch_verification_status) { is_expected.to eq "warning" } its(:warning?) { is_expected.to be true } - its(:verification_tooltip) { is_expected.to eq "Pact has changed since last successful verification by Foo (v4.5.6)" } + its(:verification_tooltip) { is_expected.to eq "Pact has changed since last successful verification by Foo (4.5.6)" } end context "when the pact has not changed since the last successful verification" do let(:pseudo_branch_verification_status) { :success } its(:pseudo_branch_verification_status) { is_expected.to eq "success" } its(:warning?) { is_expected.to be false } - its(:verification_tooltip) { is_expected.to eq "Successfully verified by Foo (v4.5.6)" } + its(:verification_tooltip) { is_expected.to eq "Successfully verified by Foo (4.5.6)" } end context "when the pact verification failed" do let(:pseudo_branch_verification_status) { :failed } its(:pseudo_branch_verification_status) { is_expected.to eq "danger" } its(:warning?) { is_expected.to be false } - its(:verification_tooltip) { is_expected.to eq "Verification by Foo (v4.5.6) failed" } + its(:verification_tooltip) { is_expected.to eq "Verification by Foo (4.5.6) failed" } end end