From 0d3a4d98c0ebb7e5a97cb8151f7c348e6955002a Mon Sep 17 00:00:00 2001 From: Jonathan Chang Date: Mon, 30 Mar 2020 22:17:41 +1100 Subject: [PATCH] utils/github: add test for fetch_artifact --- Library/Homebrew/test/utils/github_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Homebrew/test/utils/github_spec.rb b/Library/Homebrew/test/utils/github_spec.rb index 936ae03ae6..c2dc27b443 100644 --- a/Library/Homebrew/test/utils/github_spec.rb +++ b/Library/Homebrew/test/utils/github_spec.rb @@ -41,4 +41,18 @@ describe GitHub do expect(results.first["title"]).to eq("Shall we run `brew update` automatically?") end end + + describe "::fetch_artifact", :needs_network do + it "fails to find a nonexistant workflow" do + expect { + subject.fetch_artifact("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") + }.to raise_error(/No artifact .+ was found/) + end + end end