Merge pull request #7417 from claui/fix-cask-loading

Fix cask loading after adding an artifact type
This commit is contained in:
Mike McQuaid 2020-04-27 08:40:19 +01:00 committed by GitHub
commit b33c823111
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 1 deletions

View File

@ -69,7 +69,7 @@ module Cask
attr_accessor :explicit
def initialize(default: nil, env: nil, explicit: {})
@default = self.class.canonicalize(default) if default
@default = DEFAULT_DIRS.merge(self.class.canonicalize(default)) if default
@env = self.class.canonicalize(env) if env
@explicit = self.class.canonicalize(explicit)

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