Skip to content

Commit

Permalink
fix: fix error occuring when can-i-deploy badge is requested and no v…
Browse files Browse the repository at this point in the history
…ersion is found

PACT-1145
  • Loading branch information
bethesque committed Jul 12, 2023
1 parent c23beb6 commit db7dee3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def badge_url
elsif pacticipant.nil?
badge_service.error_badge_url("pacticipant", "not found")
elsif version.nil?
if branch_service.find_branch(identifier_from_path.slice(:pacticipant_name, :branch_name)).nil?
if branch_service.find_branch(**identifier_from_path.slice(:pacticipant_name, :branch_name)).nil?
badge_service.error_badge_url("branch", "not found")
else
badge_service.error_badge_url("version", "not found")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ module Resources
end
end

context "when the version is not found" do
let(:version) { nil }

it "attempts to find the branch" do
expect(branch_service).to receive(:find_branch).with(pacticipant_name: "Foo", branch_name: "main")
subject
end
end

context "when the version is not found and the branch is not found" do
let(:version) { nil }
let(:branch) { nil }
Expand Down

0 comments on commit db7dee3

Please sign in to comment.