cask/config_spec: add failing test

We recently added a new global artifact and then updated a cask to
make use of that new artifact. This caused a number of `brew cask`
commands to fail for users who had the cask installed before the
artifact was added.

This commit adds test cases for that failure mode.

See also:
- https://github.com/Homebrew/brew/pull/7286#issuecomment-613376568
- https://discourse.brew.sh/t/cask-definition-is-invalid-invalid-mdimporter-stanza-key-not-found-mdimporterdir
This commit is contained in:
Claudia 2020-04-21 17:39:07 +02:00
parent 20f7f266a8
commit 374f788a3c
No known key found for this signature in database
GPG Key ID: 246AC3C0F10BE51F

View File

@ -50,4 +50,20 @@ describe Cask::Config, :cask do
expect(config.explicit[:appdir]).to eq(Pathname("/explicit/path/to/apps"))
end
end
context "when installing a cask and then adding a global default dir" do
let(:config) { described_class.new(default: { appdir: "/default/path/before/adding/fontdir" }) }
describe "#appdir" do
it "honors metadata of the installed cask" do
expect(config.appdir).to eq(Pathname("/default/path/before/adding/fontdir"))
end
end
describe "#fontdir" do
it "falls back to global default on incomplete metadata" do
expect(config.default).to include(fontdir: Pathname(TEST_TMPDIR).join("cask-fontdir"))
end
end
end
end