Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save apainintheneck/66f828142d77f2672db8152c9fba9b74 to your computer and use it in GitHub Desktop.
Save apainintheneck/66f828142d77f2672db8152c9fba9b74 to your computer and use it in GitHub Desktop.
diff --git a/Library/Homebrew/test/formulary_spec.rb b/Library/Homebrew/test/formulary_spec.rb
index 6b53acf40c..d63121af9a 100644
--- a/Library/Homebrew/test/formulary_spec.rb
+++ b/Library/Homebrew/test/formulary_spec.rb
@@ -641,6 +641,42 @@ RSpec.describe Formulary do
# end
# end
end
+
+ context "to a third-party tap" do
+ let(:old_tap) { Tap.fetch("another", "foo") }
+ let(:new_tap) { Tap.fetch("another", "bar") }
+
+ let(:formula_file) { new_tap.formula_dir/"#{token}.rb" }
+
+ before do
+ new_tap.formula_dir.mkpath
+ FileUtils.touch formula_file
+ end
+
+ after do
+ FileUtils.rm_rf Tap::TAP_DIRECTORY/"another"
+ 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 new tap" do
+ expect do
+ described_class.loader_for("#{new_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(
+ a_string_including("Formula #{old_tap}/#{token} was renamed to #{new_tap}/#{token}.").once,
+ ).to_stderr
+ end
+ end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment