Skip to content

Commit

Permalink
specs: add :needs_github_api for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
apainintheneck committed Mar 20, 2024
1 parent 74aea8e commit 836a26b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions Library/Homebrew/test/dev-cmd/audit_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class Foo < Formula
end

it "checks online and verifies that a standard license id is the same " \
"as what is indicated on its Github repo", :needs_network do
"as what is indicated on its Github repo", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -346,7 +346,7 @@ class Cask < Formula
end

it "checks online and verifies that a standard license id with AND is the same " \
"as what is indicated on its Github repo", :needs_network do
"as what is indicated on its Github repo", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -362,7 +362,7 @@ class Cask < Formula
end

it "checks online and verifies that a standard license id with WITH is the same " \
"as what is indicated on its Github repo", :needs_network do
"as what is indicated on its Github repo", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand Down Expand Up @@ -416,7 +416,7 @@ class Cask < Formula
end

it "checks online and verifies that a standard license id is in the same exempted license group " \
"as what is indicated on its GitHub repo", :needs_network do
"as what is indicated on its GitHub repo", :needs_github_api, :needs_network do
fa = formula_auditor "cask", <<~RUBY, spdx_license_data:, online: true, new_formula: true
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -430,7 +430,7 @@ class Cask < Formula
end

it "checks online and verifies that a standard license array is in the same exempted license group " \
"as what is indicated on its GitHub repo", :needs_network do
"as what is indicated on its GitHub repo", :needs_github_api, :needs_network do
fa = formula_auditor "cask", <<~RUBY, spdx_license_data:, online: true, new_formula: true
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -444,7 +444,7 @@ class Cask < Formula
end

it "checks online and detects that a formula-specified license is not " \
"the same as what is indicated on its Github repository", :needs_network do
"the same as what is indicated on its Github repository", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -461,7 +461,7 @@ class Cask < Formula
end

it "allows a formula-specified license that differs from its GitHub " \
"repository for formulae on the mismatched license allowlist", :needs_network do
"repository for formulae on the mismatched license allowlist", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -478,7 +478,7 @@ class Cask < Formula
end

it "checks online and detects that an array of license does not contain " \
"what is indicated on its Github repository", :needs_network do
"what is indicated on its Github repository", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand All @@ -495,7 +495,7 @@ class Cask < Formula
end

it "checks online and verifies that an array of license contains " \
"what is indicated on its Github repository", :needs_network do
"what is indicated on its Github repository", :needs_github_api, :needs_network do
formula_text = <<~RUBY
class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
Expand Down
4 changes: 2 additions & 2 deletions Library/Homebrew/test/tap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ def setup_completion(link:)
end

describe "#remote" do
it "returns the remote URL", :needs_network do
it "returns the remote URL", :needs_github_api, :needs_network do
setup_git_repo

expect(homebrew_foo_tap.remote).to eq("https://github.com/Homebrew/homebrew-foo")
Expand Down Expand Up @@ -297,7 +297,7 @@ def setup_completion(link:)
expect(homebrew_foo_tap.git_last_commit).to match(/\A\d+ .+ ago\Z/)
end

specify "#private?", :needs_network do
specify "#private?", :needs_github_api, :needs_network do
expect(homebrew_foo_tap).to be_private
end

Expand Down
10 changes: 5 additions & 5 deletions Library/Homebrew/test/utils/github_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
end
end

describe "::search_issues", :needs_network do
describe "::search_issues", :needs_github_api, :needs_network do
it "queries GitHub issues with the passed parameters" do
results = described_class.search_issues("brew search",
repo: "Homebrew/legacy-homebrew",
Expand All @@ -31,21 +31,21 @@
end
end

describe "::approved_reviews", :needs_network do
describe "::approved_reviews", :needs_github_api, :needs_network do
it "can get reviews for a pull request" do
reviews = described_class.approved_reviews("Homebrew", "homebrew-core", 1, commit: "deadbeef")
expect(reviews).to eq([])
end
end

describe "::public_member_usernames", :needs_network do
describe "::public_member_usernames", :needs_github_api, :needs_network do
it "gets the usernames of all publicly visible members of the organisation" do
response = described_class.public_member_usernames("Homebrew")
expect(response).to be_a(Array)
end
end

describe "::get_artifact_url", :needs_network do
describe "::get_artifact_url", :needs_github_api, :needs_network do
it "fails to find a nonexistent workflow" do
expect do
described_class.get_artifact_url(
Expand All @@ -72,7 +72,7 @@
end
end

describe "::pull_request_commits", :needs_network do
describe "::pull_request_commits", :needs_github_api, :needs_network do
hashes = %w[188606a4a9587365d930b02c98ad6857b1d00150 25a71fe1ea1558415d6496d23834dc70778ddee5]

it "gets commit hashes for a pull request" do
Expand Down

0 comments on commit 836a26b

Please sign in to comment.