Skip to content

Commit

Permalink
fix(frontend): remove 'v' prefix on versions during render (#313)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nenad authored and bethesque committed Oct 21, 2019
1 parent 294bfd8 commit e109a8c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/pact_broker/domain/pact.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/pact_broker/matrix/row.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/pact_broker/ui/view_models/index_item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/pact_broker/pacts/diff_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/lib/pact_broker/ui/view_models/index_item_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e109a8c

Please sign in to comment.