Fix info_spec

This commit is contained in:
Douglas Eichelberger 2025-09-07 13:20:45 -07:00
parent cd46ac9a4e
commit aa163dd89e
No known key found for this signature in database
GPG Key ID: F90193CBD547EB81
3 changed files with 7 additions and 6 deletions

View File

@ -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 }

View File

@ -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

View File

@ -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