diff --git a/Library/Homebrew/test/rubocops/conflicts_spec.rb b/Library/Homebrew/test/rubocops/conflicts_spec.rb index db8fa42e57..43fe3b5124 100644 --- a/Library/Homebrew/test/rubocops/conflicts_spec.rb +++ b/Library/Homebrew/test/rubocops/conflicts_spec.rb @@ -26,4 +26,6 @@ describe RuboCop::Cop::FormulaAudit::Conflicts do RUBY end end + + include_examples "formulae exist", described_class::WHITELIST end diff --git a/Library/Homebrew/test/rubocops/lines_spec.rb b/Library/Homebrew/test/rubocops/lines_spec.rb index 7b06f52ff9..6b6516134f 100644 --- a/Library/Homebrew/test/rubocops/lines_spec.rb +++ b/Library/Homebrew/test/rubocops/lines_spec.rb @@ -860,4 +860,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do RUBY end end + + include_examples "formulae exist", described_class::MAKE_CHECK_WHITELIST end diff --git a/Library/Homebrew/test/rubocops/urls_spec.rb b/Library/Homebrew/test/rubocops/urls_spec.rb index c82bdd3a33..c3a547f435 100644 --- a/Library/Homebrew/test/rubocops/urls_spec.rb +++ b/Library/Homebrew/test/rubocops/urls_spec.rb @@ -218,6 +218,8 @@ describe RuboCop::Cop::FormulaAudit::Urls do RUBY end end + + include_examples "formulae exist", described_class::BINARY_BOOTSTRAP_FORMULA_URLS_WHITELIST end describe RuboCop::Cop::FormulaAudit::PyPiUrls do diff --git a/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb b/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb index 35f27cc920..d74cb57d27 100644 --- a/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb +++ b/Library/Homebrew/test/rubocops/uses_from_macos_spec.rb @@ -16,4 +16,6 @@ describe RuboCop::Cop::FormulaAudit::UsesFromMacos do end RUBY end + + include_examples "formulae exist", described_class::ALLOWED_USES_FROM_MACOS_DEPS end diff --git a/Library/Homebrew/test/spec_helper.rb b/Library/Homebrew/test/spec_helper.rb index 2fc3c960b1..65490fddfa 100644 --- a/Library/Homebrew/test/spec_helper.rb +++ b/Library/Homebrew/test/spec_helper.rb @@ -52,6 +52,7 @@ require "test/support/helper/output_as_tty" require "test/support/helper/spec/shared_context/homebrew_cask" if OS.mac? require "test/support/helper/spec/shared_context/integration_test" +require "test/support/helper/spec/shared_examples/formulae_exist" TEST_DIRECTORIES = [ CoreTap.instance.path/"Formula", diff --git a/Library/Homebrew/test/support/helper/spec/shared_examples/formulae_exist.rb b/Library/Homebrew/test/support/helper/spec/shared_examples/formulae_exist.rb new file mode 100644 index 0000000000..57a6560c72 --- /dev/null +++ b/Library/Homebrew/test/support/helper/spec/shared_examples/formulae_exist.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +shared_examples "formulae exist" do |array| + array.each do |f| + it "#{f} formula exists" do + formula_path = Pathname("#{HOMEBREW_LIBRARY_PATH}/../Taps/homebrew/homebrew-core/Formula/#{f}.rb") + expect(formula_path.exist?).to be true + end + end +end diff --git a/Library/Homebrew/test/support/lib/config.rb b/Library/Homebrew/test/support/lib/config.rb index b9cb738c95..a34a660740 100644 --- a/Library/Homebrew/test/support/lib/config.rb +++ b/Library/Homebrew/test/support/lib/config.rb @@ -17,7 +17,7 @@ TEST_TMPDIR = ENV.fetch("HOMEBREW_TEST_TMPDIR") do |k| end.freeze # Paths pointing into the Homebrew code base that persist across test runs -HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY_PATH.parent/"Homebrew/shims").freeze +HOMEBREW_SHIMS_PATH = (HOMEBREW_LIBRARY_PATH/"shims").freeze require "extend/git_repository"