Skip to content

Commit

Permalink
feat: improve wording of 'no version exits' messaging in can-i-deploy…
Browse files Browse the repository at this point in the history
… response
  • Loading branch information
bethesque committed Aug 29, 2023
1 parent 239adbf commit 9529c67
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions lib/pact_broker/matrix/resolved_selector.rb
Expand Up @@ -202,10 +202,10 @@ def description
"the latest version of #{pacticipant_name} with tag #{tag} (#{pacticipant_version_number})"
elsif latest_tagged?
"the latest version of #{pacticipant_name} with tag #{tag} (no such version exists)"
elsif main_branch? && pacticipant_version_number.nil?
"a version of #{pacticipant_name} from the main branch (no such version exists)"
elsif latest_from_main_branch? && pacticipant_version_number.nil?
"the latest version of #{pacticipant_name} from the main branch (no such verison exists)"
"the latest version of #{pacticipant_name} from the main branch (no versions exist for this branch)"
elsif main_branch? && pacticipant_version_number.nil?
"any version of #{pacticipant_name} from the main branch (no versions exist for this branch)"
elsif latest_from_branch? && pacticipant_version_number
"the latest version of #{pacticipant_name} from branch #{branch} (#{pacticipant_version_number})"
elsif latest_from_branch?
Expand Down
5 changes: 3 additions & 2 deletions spec/lib/pact_broker/matrix/resolved_selector_spec.rb
Expand Up @@ -200,16 +200,17 @@ module Matrix

context "when specified by main_branch" do
let(:main_branch) { true }
let(:latest) { nil }

its(:description) { is_expected.to eq "a version of Foo from the main branch (no such version exists)" }
its(:description) { is_expected.to eq "any version of Foo from the main branch (no versions exist for this branch)" }
its(:version_does_not_exist_description) { is_expected.to eq "No version of Foo from the main branch exists" }
end

context "when specified by main_branch and latest" do
let(:main_branch) { true }
let(:latest) { true }

its(:description) { is_expected.to eq "a version of Foo from the main branch (no such version exists)" }
its(:description) { is_expected.to eq "the latest version of Foo from the main branch (no versions exist for this branch)" }
its(:version_does_not_exist_description) { is_expected.to eq "No version of Foo from the main branch exists" }
end
end
Expand Down

0 comments on commit 9529c67

Please sign in to comment.