diff --git a/Library/.rubocop.yml b/Library/.rubocop.yml index 819723b411..01a6d8819b 100644 --- a/Library/.rubocop.yml +++ b/Library/.rubocop.yml @@ -15,8 +15,7 @@ AllCops: TargetRubyVersion: 3.1 NewCops: enable Include: - # FIXME: https://github.com/rubocop/rubocop/issues/12695 - - "Homebrew/**/*.rbi" + - "**/*.rbi" Exclude: - "Homebrew/sorbet/rbi/{dsl,gems}/**/*.rbi" - "Homebrew/sorbet/rbi/parlour.rbi" @@ -228,8 +227,6 @@ RSpec: # Intentionally disabled as it doesn't fit with our code style. RSpec/AnyInstance: Enabled: false -RSpec/DescribeClass: - Enabled: false RSpec/SpecFilePathFormat: Enabled: false RSpec/StubbedMock: diff --git a/Library/Homebrew/test/api/internal_tap_json/formula_spec.rb b/Library/Homebrew/test/api/internal_tap_json/formula_spec.rb index a6347e1806..b6a495922c 100644 --- a/Library/Homebrew/test/api/internal_tap_json/formula_spec.rb +++ b/Library/Homebrew/test/api/internal_tap_json/formula_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Internal Tap JSON -- Formula" do +RSpec.describe "Internal Tap JSON -- Formula", type: :system do include FileUtils let(:internal_tap_json) { File.read(TEST_FIXTURE_DIR/"internal_tap_json/homebrew-core.json").chomp } diff --git a/Library/Homebrew/test/cask/conflicts_with_spec.rb b/Library/Homebrew/test/cask/conflicts_with_spec.rb deleted file mode 100644 index 329a10e66a..0000000000 --- a/Library/Homebrew/test/cask/conflicts_with_spec.rb +++ /dev/null @@ -1,25 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe "conflicts_with", :cask do - describe "conflicts_with cask" do - let(:local_caffeine) do - Cask::CaskLoader.load(cask_path("local-caffeine")) - end - - let(:with_conflicts_with) do - Cask::CaskLoader.load(cask_path("with-conflicts-with")) - end - - it "installs the dependency of a Cask and the Cask itself" do - Cask::Installer.new(local_caffeine).install - - expect(local_caffeine).to be_installed - - expect do - Cask::Installer.new(with_conflicts_with).install - end.to raise_error(Cask::CaskConflictError, "Cask 'with-conflicts-with' conflicts with 'local-caffeine'.") - - expect(with_conflicts_with).not_to be_installed - end - end -end diff --git a/Library/Homebrew/test/cask/depends_on_spec.rb b/Library/Homebrew/test/cask/depends_on_spec.rb index dfb444abc5..c2f0373ddb 100644 --- a/Library/Homebrew/test/cask/depends_on_spec.rb +++ b/Library/Homebrew/test/cask/depends_on_spec.rb @@ -2,7 +2,9 @@ # TODO: this test should be named after the corresponding class, once # that class is abstracted from installer.rb +# rubocop:disable RSpec/DescribeClass RSpec.describe "Satisfy Dependencies and Requirements", :cask do + # rubocop:enable RSpec/DescribeClass subject(:install) do Cask::Installer.new(cask).install end diff --git a/Library/Homebrew/test/cask/dsl_spec.rb b/Library/Homebrew/test/cask/dsl_spec.rb index 3cc70983d1..891c33a3a1 100644 --- a/Library/Homebrew/test/cask/dsl_spec.rb +++ b/Library/Homebrew/test/cask/dsl_spec.rb @@ -444,6 +444,28 @@ RSpec.describe Cask::DSL, :cask do end end + describe "conflicts_with cask" do + let(:local_caffeine) do + Cask::CaskLoader.load(cask_path("local-caffeine")) + end + + let(:with_conflicts_with) do + Cask::CaskLoader.load(cask_path("with-conflicts-with")) + end + + it "installs the dependency of a Cask and the Cask itself" do + Cask::Installer.new(local_caffeine).install + + expect(local_caffeine).to be_installed + + expect do + Cask::Installer.new(with_conflicts_with).install + end.to raise_error(Cask::CaskConflictError, "Cask 'with-conflicts-with' conflicts with 'local-caffeine'.") + + expect(with_conflicts_with).not_to be_installed + end + end + describe "conflicts_with stanza" do context "when valid" do let(:token) { "with-conflicts-with" } diff --git a/Library/Homebrew/test/cmd/--version_spec.rb b/Library/Homebrew/test/cmd/--version_spec.rb index 75cf483a52..772fd5348c 100644 --- a/Library/Homebrew/test/cmd/--version_spec.rb +++ b/Library/Homebrew/test/cmd/--version_spec.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -require "cmd/shared_examples/args_parse" - -RSpec.describe "brew --version" do +RSpec.describe "brew --version", type: :system do it "prints the Homebrew's version", :integration_test do expect { brew_sh "--version" } .to output(/^Homebrew #{Regexp.escape(HOMEBREW_VERSION)}\n/o).to_stdout diff --git a/Library/Homebrew/test/cmd/custom-external-command_spec.rb b/Library/Homebrew/test/cmd/custom-external-command_spec.rb index d16bb4ad54..cabfc5efd1 100644 --- a/Library/Homebrew/test/cmd/custom-external-command_spec.rb +++ b/Library/Homebrew/test/cmd/custom-external-command_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "brew custom-external-command", :integration_test do +RSpec.describe "brew custom-external-command", :integration_test, type: :system do it "is supported" do mktmpdir do |path| cmd = "custom-external-command-#{rand}" diff --git a/Library/Homebrew/test/extend/kernel_spec.rb b/Library/Homebrew/test/extend/kernel_spec.rb index eb81687878..200756b4cf 100644 --- a/Library/Homebrew/test/extend/kernel_spec.rb +++ b/Library/Homebrew/test/extend/kernel_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "globally-scoped helper methods" do +RSpec.describe Kernel do let(:dir) { mktmpdir } def esc(code) diff --git a/Library/Homebrew/test/global_spec.rb b/Library/Homebrew/test/global_spec.rb index 76abb380f0..9a7450abd8 100644 --- a/Library/Homebrew/test/global_spec.rb +++ b/Library/Homebrew/test/global_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "brew", :integration_test do +RSpec.describe Homebrew, :integration_test do it "does not invoke `require \"formula\"` at startup" do expect { brew "verify-formula-undefined" } .to not_to_output.to_stdout diff --git a/Library/Homebrew/test/os/mac/mach_spec.rb b/Library/Homebrew/test/os/mac/mach_spec.rb index 4f6da3938f..28d4f1f882 100644 --- a/Library/Homebrew/test/os/mac/mach_spec.rb +++ b/Library/Homebrew/test/os/mac/mach_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe "Mach-O" do +RSpec.describe MachOShim do describe "Pathname tests" do specify "fat dylib" do pn = dylib_path("fat") diff --git a/Library/Homebrew/test/os/mac/pkgconfig_spec.rb b/Library/Homebrew/test/os/mac/pkgconfig_spec.rb index 849c17b332..21177c94d6 100644 --- a/Library/Homebrew/test/os/mac/pkgconfig_spec.rb +++ b/Library/Homebrew/test/os/mac/pkgconfig_spec.rb @@ -12,7 +12,7 @@ # Additionally, libffi version detection cannot be performed on systems running Mojave or earlier. # # For indeterminable cases, consult https://opensource.apple.com for the version used. -RSpec.describe "pkg-config", :needs_ci do +RSpec.describe "pkg-config", :needs_ci, type: :system do def pc_version(library) path = HOMEBREW_LIBRARY_PATH/"os/mac/pkgconfig/#{MacOS.version}/#{library}.pc" version = File.foreach(path) diff --git a/Library/Homebrew/test/patching_spec.rb b/Library/Homebrew/test/patching_spec.rb index 7ca14c511c..74171d0535 100644 --- a/Library/Homebrew/test/patching_spec.rb +++ b/Library/Homebrew/test/patching_spec.rb @@ -2,7 +2,7 @@ require "formula" -RSpec.describe "patching" do +RSpec.describe "patching", type: :system do let(:formula_subclass) do Class.new(Formula) do # These are defined within an anonymous class to avoid polluting the global namespace. @@ -229,15 +229,3 @@ RSpec.describe "patching" do end.to raise_error(BuildError) end end - -__END__ -diff --git a/libexec/NOOP b/libexec/NOOP -index bfdda4c..e08d8f4 100755 ---- a/libexec/NOOP -+++ b/libexec/NOOP -@@ -1,2 +1,2 @@ - #!/bin/bash --echo NOOP -\ No newline at end of file -+echo ABCD -\ No newline at end of file diff --git a/Library/Homebrew/test/sorbet/tapioca/config_spec.rb b/Library/Homebrew/test/sorbet/tapioca/config_spec.rb index 6a1449bc7c..3fb5101618 100644 --- a/Library/Homebrew/test/sorbet/tapioca/config_spec.rb +++ b/Library/Homebrew/test/sorbet/tapioca/config_spec.rb @@ -3,7 +3,7 @@ require "rubygems" require "yaml" -RSpec.describe "Tapioca Config" do +RSpec.describe "Tapioca Config", type: :system do let(:config) { YAML.load_file(File.join(__dir__, "../../../sorbet/tapioca/config.yml")) } it "only excludes dependencies" do