From 7d63f0b5061960a8dc638e490b19b73d57d6d0f0 Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Tue, 14 Apr 2020 17:37:08 +1000 Subject: [PATCH] github: improve tests --- Library/Homebrew/test/utils/github_spec.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb index c2dc27b443..939ac6de5b 100644 --- a/Library/Homebrew/test/utils/github_spec.rb +++ b/Library/Homebrew/test/utils/github_spec.rb @@ -42,17 +42,22 @@ describe GitHub do end end - describe "::fetch_artifact", :needs_network do + describe "::get_artifact_url", :needs_network do it "fails to find a nonexistant workflow" do expect { - subject.fetch_artifact("Homebrew", "homebrew-core", 1, ".") + subject.get_artifact_url("Homebrew", "homebrew-core", 1) }.to raise_error(/No matching workflow run found/) end it "fails to find artifacts that don't exist" do expect { - subject.fetch_artifact("Homebrew", "homebrew-core", 51971, ".", artifact_name: "false_bottles") + subject.get_artifact_url("Homebrew", "homebrew-core", 51971, artifact_name: "false_bottles") }.to raise_error(/No artifact .+ was found/) end + + it "gets an artifact link" do + url = subject.get_artifact_url("Homebrew", "homebrew-core", 51971, artifact_name: "bottles") + expect(url).to eq("https://api.github.com/repos/Homebrew/homebrew-core/actions/artifacts/3557392/zip") + end end end