diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 86ce3d1451..1a8afb24a9 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -203,7 +203,7 @@ module Formulary @caveats_string = json_formula["caveats"] def caveats - @caveats_string + self.class.instance_variable_get(:@caveats_string) end end diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb index a631cf491a..6276ecf876 100644 --- a/Library/Homebrew/test/formulary_spec.rb +++ b/Library/Homebrew/test/formulary_spec.rb @@ -241,7 +241,7 @@ describe Formulary do "recommended_dependencies" => ["recommended_dep"], "optional_dependencies" => ["optional_dep"], "uses_from_macos" => ["uses_from_macos_dep"], - "caveats" => "", + "caveats" => "example caveat string", }.merge(extra_items), } end @@ -276,6 +276,7 @@ describe Formulary do expect(formula.deps.count).to eq 5 end expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"] + expect(formula.caveats).to eq "example caveat string" expect { formula.install }.to raise_error("Cannot build from source from abstract formula.")