This commit fixes the PR #7417 bug.
The call to `canonicalize` needs to wrap `DEFAULT_DIRS`, not the
other way around. This was mixed up in PR #7417 due to an oversight.
This commit fixes a flaw in the Cask test helper, causing the broken `Cask::Config` test to actually fail.
The flaw occurred while patching the `Cask::Config::DEFAULT_DIRS` hash.
While the original hash uses strings as values, the patched one used
`Pathname` values, masking a broken `Cask::Config::from_json` test.
Now the broken test fails like it should.
This commit adds a broken test, which is meant to expose a flaw in the
constructor of `Cask::Config`.
That (broken) test still passes because there’s also a flaw in our
test helper code.
The helper flaw happens to neutralize the `Cask::Config` flaw.
Previously, the JSON-based cask config loader was untested.
This commit changes the interface to accept a string, making the loader
easier to test. The commit also adds a test.
- My editor converted some of these to spaces when I changed the lines
in the previous commit. We should be consistent, so I made all of them
into spaces.
- I suggested this for the contents of
[Linuxbrew/docker](https://github.com/Linuxbrew/docker) in
https://github.com/Linuxbrew/docker/issues/75. People agreed, and
Shaun asked me to do the same here.
- This adds a step to CI to lint the Dockerfile, via
[hadolint](https://github.com/hadolint/hadolint), on Ubuntu.
- The linting errors it surfaced on this Dockerfile were:
```
Dockerfile:4 DL3008 Pin versions in apt get install. Instead of `apt-get install <package>` use `apt-get install <package>=<version>`
Dockerfile:30 DL3020 Use COPY instead of ADD for files and folders
Dockerfile:32 DL3003 Use WORKDIR to switch to a directory
```
- [DL3008](https://github.com/hadolint/hadolint/wiki/DL3008) - pinning
versions in `apt-get install` - is at odds with what we recommend in the
normal Homebrew on Linux dependency install instructions. We don't
want the dependency management of having to check each of these
Dockerfiles periodically for the latest version numbers of packages
and have to update them. So I've disabled this lint.
- [DL3003](https://github.com/hadolint/hadolint/wiki/DL3003) - use
WORKDIR to `cd` - is disabled in this case due to [review
comments](https://github.com/Homebrew/brew/pull/7433/files#r415098255).