diff --git a/Library/Homebrew/test/cask/cask_spec.rb b/Library/Homebrew/test/cask/cask_spec.rb index fea5589a37025c..68a881d2d89fb7 100644 --- a/Library/Homebrew/test/cask/cask_spec.rb +++ b/Library/Homebrew/test/cask/cask_spec.rb @@ -46,13 +46,15 @@ expect(c.token).to eq("caffeine") end - it "returns an instance of the Cask from a URL" do + it "returns an instance of the Cask from a URL", :allow_utils_curl do + expect(Homebrew::API).not_to receive(:fetch_json_api_file) c = Cask::CaskLoader.load("file://#{tap_path}/Casks/local-caffeine.rb") expect(c).to be_a(described_class) expect(c.token).to eq("local-caffeine") end - it "raises an error when failing to download a Cask from a URL" do + it "raises an error when failing to download a Cask from a URL", :allow_utils_curl do + expect(Homebrew::API).not_to receive(:fetch_json_api_file) expect do Cask::CaskLoader.load("file://#{tap_path}/Casks/notacask.rb") end.to raise_error(Cask::CaskUnavailableError) diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index fa4d31b1ab959d..7b31cc0e038d56 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -119,7 +119,8 @@ class Wrong#{described_class.class_s(formula_name)} < Formula expect(described_class.factory(formula_path)).to be_a(Formula) end - it "returns a Formula when given a URL" do + it "returns a Formula when given a URL", :allow_utils_curl do + expect(Homebrew::API).not_to receive(:fetch_json_api_file) formula = described_class.factory("file://#{formula_path}") expect(formula).to be_a(Formula) end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 1b3292dc3d6f35..3b26f04a214c7d 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -173,6 +173,7 @@ config.before do |example| next if example.metadata.key?(:needs_network) + next if example.metadata.key?(:allow_utils_curl) DISALLOWED_UTILS_CURL_METHODS.each do |method| allow(Utils::Curl).to receive(method).and_raise(<<~ERROR)