From aa163dd89e3ccc4d69088c42e420f30e33c4948c Mon Sep 17 00:00:00 2001 From: Douglas Eichelberger Date: Sun, 7 Sep 2025 13:20:45 -0700 Subject: [PATCH] Fix info_spec --- Library/Homebrew/PATH.rb | 2 +- Library/Homebrew/bundle/commands/cleanup.rb | 2 +- Library/Homebrew/test/services/commands/info_spec.rb | 9 +++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/PATH.rb b/Library/Homebrew/PATH.rb index 90da11abe9..0aea775d98 100644 --- a/Library/Homebrew/PATH.rb +++ b/Library/Homebrew/PATH.rb @@ -12,7 +12,7 @@ class PATH delegate each: :@paths Elem = type_member(:out) { { fixed: String } } - Element = T.type_alias { T.any(NilClass, Pathname, String, PATH) } + Element = T.type_alias { T.nilable(T.any(Pathname, String, PATH)) } private_constant :Element Elements = T.type_alias { T.any(Element, T::Array[Element]) } sig { params(paths: Elements).void } diff --git a/Library/Homebrew/bundle/commands/cleanup.rb b/Library/Homebrew/bundle/commands/cleanup.rb index 2715fed00b..9eb6847f44 100644 --- a/Library/Homebrew/bundle/commands/cleanup.rb +++ b/Library/Homebrew/bundle/commands/cleanup.rb @@ -183,7 +183,7 @@ module Homebrew require "bundle/tap_dumper" @dsl ||= Brewfile.read(global:, file:) - kept_formulae = self.kept_formulae(global:, file:).filter_map { lookup_formula(_1) } + kept_formulae = self.kept_formulae(global:, file:).filter_map(&method(:lookup_formula)) kept_taps = @dsl.entries.select { |e| e.type == :tap }.map(&:name) kept_taps += kept_formulae.filter_map(&:tap).map(&:name) current_taps = Homebrew::Bundle::TapDumper.tap_names diff --git a/Library/Homebrew/test/services/commands/info_spec.rb b/Library/Homebrew/test/services/commands/info_spec.rb index 8b5c5cefee..788f229299 100644 --- a/Library/Homebrew/test/services/commands/info_spec.rb +++ b/Library/Homebrew/test/services/commands/info_spec.rb @@ -23,7 +23,7 @@ RSpec.describe Homebrew::Services::Commands::Info do it "succeeds with items" do out = "service ()\nRunning: true\nLoaded: true\nSchedulable: false\n" - formula = { + formula_wrapper = instance_double(Homebrew::Services::FormulaWrapper, to_hash: { name: "service", user: "user", status: :started, @@ -31,9 +31,9 @@ RSpec.describe Homebrew::Services::Commands::Info do running: true, loaded: true, schedulable: false, - } + }) expect do - described_class.run([formula], verbose: false, json: false) + described_class.run([formula_wrapper], verbose: false, json: false) end.to output(out).to_stdout end @@ -48,8 +48,9 @@ RSpec.describe Homebrew::Services::Commands::Info do schedulable: false, } out = "#{JSON.pretty_generate([formula])}\n" + formula_wrapper = instance_double(Homebrew::Services::FormulaWrapper, to_hash: formula) expect do - described_class.run([formula], verbose: false, json: true) + described_class.run([formula_wrapper], verbose: false, json: true) end.to output(out).to_stdout end end