Add tests for formula migration warnings to default tap.
This commit is contained in:
parent
c8058a3859
commit
228ebe0c32
@ -528,4 +528,47 @@ describe Formulary do
|
|||||||
expect(described_class.convert_to_string_or_symbol(":foo")).to eq :foo
|
expect(described_class.convert_to_string_or_symbol(":foo")).to eq :foo
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "::loader_for" do
|
||||||
|
context "when not using the API" do
|
||||||
|
before do
|
||||||
|
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when a formula is migrated to the default tap" do
|
||||||
|
let(:token) { "local-caffeine" }
|
||||||
|
let(:tap_migrations) do
|
||||||
|
{
|
||||||
|
token => default_tap.name,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let(:old_tap) { CoreCaskTap.instance }
|
||||||
|
let(:default_tap) { CoreTap.instance }
|
||||||
|
|
||||||
|
before do
|
||||||
|
old_tap.path.mkpath
|
||||||
|
(old_tap.path/"tap_migrations.json").write tap_migrations.to_json
|
||||||
|
old_tap.clear_cache
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not warn when loading the short token" do
|
||||||
|
expect do
|
||||||
|
described_class.loader_for(token)
|
||||||
|
end.not_to output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
it "does not warn when loading the full token in the default tap" do
|
||||||
|
expect do
|
||||||
|
described_class.loader_for("#{default_tap}/#{token}")
|
||||||
|
end.not_to output.to_stderr
|
||||||
|
end
|
||||||
|
|
||||||
|
it "warns when loading the full token in the old tap" do
|
||||||
|
expect do
|
||||||
|
described_class.loader_for("#{old_tap}/#{token}")
|
||||||
|
end.to output(%r{Formula #{old_tap}/#{token} was renamed to #{token}\.}).to_stderr
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user