Skip to content

Commit

Permalink
Add test for cask migrations to default tap.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Feb 13, 2024
1 parent 0e99f78 commit ba6244c
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions Library/Homebrew/test/cask/cask_loader_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,45 @@
end
end
end

context "when not using the API" do
before do
ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
end

context "when a cask is migrated to the default tap" do
let(:token) { "local-caffeine" }
let(:tap_migrations) do
{
token => default_tap.name,
}
end
let(:old_tap) { CoreTap.instance }
let(:default_tap) { CoreCaskTap.instance }

before do
(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.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.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.for("#{old_tap}/#{token}")
end.to output(%r{Cask #{old_tap}/#{token} was renamed to #{token}\.}).to_stderr
end
end
end
end
end

0 comments on commit ba6244c

Please sign in to comment.