diff --git a/Library/Homebrew/test/dev-cmd/audit_spec.rb b/Library/Homebrew/test/dev-cmd/audit_spec.rb index 9802f40bd4..6878142d3a 100644 --- a/Library/Homebrew/test/dev-cmd/audit_spec.rb +++ b/Library/Homebrew/test/dev-cmd/audit_spec.rb @@ -106,8 +106,21 @@ module Homebrew let(:custom_spdx_id) { "zzz" } let(:standard_mismatch_spdx_id) { "0BSD" } + it "does not check if the formula is not a new formula" do + fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids, new_formula: false + class Foo < Formula + url "https://brew.sh/foo-1.0.tgz" + license "" + end + RUBY + + fa.audit_license + p fa.problems + expect(fa.problems).to be_empty + end + it "detects no license info" do - fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids + fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids, new_formula: true class Foo < Formula url "https://brew.sh/foo-1.0.tgz" license "" @@ -120,7 +133,7 @@ module Homebrew end it "detects if license is not a standard spdx-id" do - fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids + fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids, new_formula: true class Foo < Formula url "https://brew.sh/foo-1.0.tgz" license "#{custom_spdx_id}" @@ -132,7 +145,7 @@ module Homebrew end it "verifies that a license info is a standard spdx id" do - fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids + fa = formula_auditor "foo", <<~RUBY, spdx_ids: spdx_ids, new_formula: true class Foo < Formula url "https://brew.sh/foo-1.0.tgz" license "0BSD" @@ -145,7 +158,7 @@ module Homebrew it "checks online and verifies that a standard license id is the same "\ "as what is indicated on its Github repo" do - fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true + fa = formula_auditor "cask", <<~RUBY, spdx_ids: spdx_ids, online: true, core_tap: true, new_formula: true class Cask < Formula url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" head "https://github.com/cask/cask.git" @@ -159,7 +172,7 @@ module Homebrew it "checks online and detects that a formula-specified license is not "\ "the same as what is indicated on its Github repository" do - fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true + fa = formula_auditor "cask", <<~RUBY, online: true, spdx_ids: spdx_ids, core_tap: true, new_formula: true class Cask < Formula url "https://github.com/cask/cask/archive/v0.8.4.tar.gz" head "https://github.com/cask/cask.git"