audit_spec: override core-tap attribute in online test

This commit is contained in:
lionellloh 2020-06-17 05:19:38 +08:00
parent e8f6e651d1
commit 03fc6b2c15
2 changed files with 14 additions and 17 deletions

View File

@ -357,8 +357,8 @@ module Homebrew
github_license = get_repo_license_data(user, repo) github_license = get_repo_license_data(user, repo)
return if github_license && (github_license == formula.license) return if github_license && (github_license == formula.license)
problem "License mismatch - Github license is: #{github_license}, \ problem "License mismatch - Github license is: #{github_license}, "\
but Formulae license states: #{formula.license}." "but Formulae license states: #{formula.license}."
else else
problem "#{formula.license} is not a standard SPDX license id." problem "#{formula.license} is not a standard SPDX license id."
end end

View File

@ -141,11 +141,11 @@ module Homebrew
expect(fa.problems).to be_empty expect(fa.problems).to be_empty
end end
it "checks online and verifies that a standard license id is the same as what is indicated on its Github repo" do it "checks online and verifies that a standard license id is the same "\
fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true "as what is indicated on its Github repo" do
fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true
class Cask < Formula class Cask < Formula
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
sha256 "02f8bb20b33b23fb11e7d2a1d282519dfdb8b3090b9672448b8c2c2cacd3e478"
head "https://github.com/cask/cask.git" head "https://github.com/cask/cask.git"
license "GPL-3.0" license "GPL-3.0"
end end
@ -155,23 +155,20 @@ module Homebrew
expect(fa.problems).to be_empty expect(fa.problems).to be_empty
end end
# TODO: fix this test it "checks online and detects that a formula-specified license is not "\
it "checks online and detects that a formula-specified license is not the same as what is indicated on its Github repository" do "the same as what is indicated on its Github repository" do
fa = formula_auditor "cask", <<~RUBY, strict: true, online: true, spdx_ids: spdx_ids # odie "lol"
fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true
class Cask < Formula class Cask < Formula
desc "Emacs dependency management" url "https://github.com/cask/cask/archive/v0.8.4.tar.gz"
homepage "https://cask.readthedocs.org/" head "https://github.com/cask/cask.git"
url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" license "#{standard_mismatch_spdx_id}"
sha256 "02f8bb20b33b23fb11e7d2a1d282519dfdb8b3090b9672448b8c2c2cacd3e478"
head "https://github.com/cask/cask.git"
license "0BSD"
end end
RUBY RUBY
fa.audit_license fa.audit_license
expect(fa.problems).to be_empty expect(fa.problems.first).to match "License mismatch - Github license is: GPL-3.0, "\
# match "License mismatch - Github license is: GPL-3.0, \ "but Formulae license states: #{standard_mismatch_spdx_id}."
# but Formulae license states: #{standard_mismatch_spdx_id}."
end end
end end