Fix caveats when loading from the API

This commit is contained in:
Rylan Polster 2022-06-16 19:36:32 -04:00
parent 0ea9f5ec80
commit 15cf890ed7
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 3 additions and 2 deletions

View File

@ -203,7 +203,7 @@ module Formulary
@caveats_string = json_formula["caveats"] @caveats_string = json_formula["caveats"]
def caveats def caveats
@caveats_string self.class.instance_variable_get(:@caveats_string)
end end
end end

View File

@ -241,7 +241,7 @@ describe Formulary do
"recommended_dependencies" => ["recommended_dep"], "recommended_dependencies" => ["recommended_dep"],
"optional_dependencies" => ["optional_dep"], "optional_dependencies" => ["optional_dep"],
"uses_from_macos" => ["uses_from_macos_dep"], "uses_from_macos" => ["uses_from_macos_dep"],
"caveats" => "", "caveats" => "example caveat string",
}.merge(extra_items), }.merge(extra_items),
} }
end end
@ -276,6 +276,7 @@ describe Formulary do
expect(formula.deps.count).to eq 5 expect(formula.deps.count).to eq 5
end end
expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"] expect(formula.uses_from_macos_elements).to eq ["uses_from_macos_dep"]
expect(formula.caveats).to eq "example caveat string"
expect { expect {
formula.install formula.install
}.to raise_error("Cannot build from source from abstract formula.") }.to raise_error("Cannot build from source from abstract formula.")