aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cask/test/support
diff options
context:
space:
mode:
authorAnastasiaSulyagina2016-08-18 22:11:42 +0300
committerAnastasiaSulyagina2016-08-19 14:50:14 +0300
commite81f4ab7deeb40308f240be5ea00091fc8786d7a (patch)
treeb5418f9149de71c0f05f90cb2b39ab47f46e27b4 /Library/Homebrew/cask/test/support
parent5c7c9de669025bbe4cad9829be39c5cf3b31ad25 (diff)
downloadbrew-e81f4ab7deeb40308f240be5ea00091fc8786d7a.tar.bz2
init
Diffstat (limited to 'Library/Homebrew/cask/test/support')
l---------Library/Homebrew/cask/test/support/Casks/.rubocop.yml1
-rw-r--r--Library/Homebrew/cask/test/support/Casks/adobe-air-container.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/appdir-interpolation.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/auto-updates.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/bad-checksum.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/basic-cask.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/bzipped-asset.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/cab-container.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/gzipped-asset.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-multiple.rb13
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-url.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-conflicts-with-key.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-arch-value.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-key.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-bad-release.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-x11-value.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-id.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-url.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-missing-key.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb13
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-parameter.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-signature-url.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-type.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-format.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-token-mismatch.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-version.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-stage-only-conflict.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-homepage.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-url.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-version.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/local-caffeine.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/local-transmission.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/lzma-asset.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/missing-checksum.rb8
-rw-r--r--Library/Homebrew/cask/test/support/Casks/naked-executable.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/naked-pkg.rb7
-rw-r--r--Library/Homebrew/cask/test/support/Casks/nested-app.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/no-checksum.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/no-dsl-version.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/rar-container.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/sevenzip-container.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/stage-only.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/stuffit-container.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/tarball.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/test-opera-mail.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/test-opera.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-accessibility-access.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-alt-target.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-appcast.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-caveats.rb23
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-conditional-caveats.rb14
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-conflicts-with.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic-helper.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-multiple.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-cask.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-formula-multiple.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-formula.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-array.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-comparison.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-failure.rb12
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-string.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-symbol.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-x11-false.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-depends-on-x11.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-generic-artifact-no-target.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-generic-artifact.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-gpg-key-url.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-gpg.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-installable.rb20
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-installer-manual.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-installer-script.rb15
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-license.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-macosx-dir.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-pkgutil-zap.rb13
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-suite.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-two-apps-correct.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-two-apps-incorrect.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-two-apps-subdir.rb10
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-delete.rb16
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-early-script.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-kext.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-launchctl.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-login-item.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-pkgutil.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-quit.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-rmdir.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-script.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-signal.rb14
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-uninstall-trash.rb16
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-delete.rb16
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-early-script.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-kext.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-launchctl.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-login-item.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-pkgutil.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-quit.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-rmdir.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-script.rb11
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-signal.rb14
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap-trash.rb16
-rw-r--r--Library/Homebrew/cask/test/support/Casks/with-zap.rb19
-rw-r--r--Library/Homebrew/cask/test/support/Casks/xar-container.rb9
-rw-r--r--Library/Homebrew/cask/test/support/Casks/xzipped-asset.rb11
-rwxr-xr-xLibrary/Homebrew/cask/test/support/binaries/2_app_caffeine.zipbin0 -> 519212 bytes
-rwxr-xr-xLibrary/Homebrew/cask/test/support/binaries/2_app_subdir.zipbin0 -> 519806 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/GMDesk-1.01.airbin0 -> 112191 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/MyFancyApp.zipbin0 -> 304 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/MyFancyPkg.zipbin0 -> 532 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/Naked.pkgbin0 -> 516 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/NestedApp.dmg.zipbin0 -> 2494 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/bzipped_asset.bz2bin0 -> 59 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/cabcontainer.cabbin0 -> 139 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/caffeine.zipbin0 -> 260503 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/caffeine_suite.zipbin0 -> 261177 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/empty_directory/.gitignore0
-rw-r--r--Library/Homebrew/cask/test/support/binaries/gzipped_asset.gzbin0 -> 51 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/lzma-asset.lzmabin0 -> 41 bytes
-rwxr-xr-xLibrary/Homebrew/cask/test/support/binaries/naked_executable2
-rw-r--r--Library/Homebrew/cask/test/support/binaries/rarcontainer.rarbin0 -> 308 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/sevenzipcontainer.7zbin0 -> 247 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/sheldonmac.sitbin0 -> 5633 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/tarball.tgzbin0 -> 188 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/transmission-2.61.dmgbin0 -> 4659049 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/xarcontainer.xarbin0 -> 790 bytes
-rw-r--r--Library/Homebrew/cask/test/support/binaries/xzipped-asset.xzbin0 -> 76 bytes
-rw-r--r--Library/Homebrew/cask/test/support/cleanup.rb12
-rw-r--r--Library/Homebrew/cask/test/support/fake_dirs.rb29
-rw-r--r--Library/Homebrew/cask/test/support/fake_fetcher.rb35
-rw-r--r--Library/Homebrew/cask/test/support/fake_system_command.rb73
-rw-r--r--Library/Homebrew/cask/test/support/never_sudo_system_command.rb5
-rw-r--r--Library/Homebrew/cask/test/support/shared_examples.rb21
-rw-r--r--Library/Homebrew/cask/test/support/shared_examples/dsl_base.rb23
-rw-r--r--Library/Homebrew/cask/test/support/shared_examples/staged.rb109
140 files changed, 1520 insertions, 0 deletions
diff --git a/Library/Homebrew/cask/test/support/Casks/.rubocop.yml b/Library/Homebrew/cask/test/support/Casks/.rubocop.yml
new file mode 120000
index 000000000..ee5c2b948
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/.rubocop.yml
@@ -0,0 +1 @@
+../../../Casks/.rubocop.yml \ No newline at end of file
diff --git a/Library/Homebrew/cask/test/support/Casks/adobe-air-container.rb b/Library/Homebrew/cask/test/support/Casks/adobe-air-container.rb
new file mode 100644
index 000000000..302f15703
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/adobe-air-container.rb
@@ -0,0 +1,9 @@
+test_cask 'adobe-air-container' do
+ version '1.0.1'
+ sha256 '9b6e4174afa76f2af50238364fcf87525bc4ed2287acbe62925107ab6cda5c99'
+
+ url TestHelper.local_binary_url('GMDesk-1.01.air')
+ homepage 'http://robertnyman.com/gmdesk/'
+
+ app 'GMDesk.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/appdir-interpolation.rb b/Library/Homebrew/cask/test/support/Casks/appdir-interpolation.rb
new file mode 100644
index 000000000..6aa3f29c3
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/appdir-interpolation.rb
@@ -0,0 +1,9 @@
+test_cask 'appdir-interpolation' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/appdir-interpolation'
+
+ binary "#{appdir}/some/path"
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/auto-updates.rb b/Library/Homebrew/cask/test/support/Casks/auto-updates.rb
new file mode 100644
index 000000000..f49060f83
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/auto-updates.rb
@@ -0,0 +1,11 @@
+test_cask 'auto-updates' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/auto-updates'
+
+ auto_updates true
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/bad-checksum.rb b/Library/Homebrew/cask/test/support/Casks/bad-checksum.rb
new file mode 100644
index 000000000..074dae01f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/bad-checksum.rb
@@ -0,0 +1,9 @@
+test_cask 'bad-checksum' do
+ version '1.2.3'
+ sha256 'badbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadbadb'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/basic-cask.rb b/Library/Homebrew/cask/test/support/Casks/basic-cask.rb
new file mode 100644
index 000000000..d3aaa283e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/basic-cask.rb
@@ -0,0 +1,9 @@
+test_cask 'basic-cask' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/bzipped-asset.rb b/Library/Homebrew/cask/test/support/Casks/bzipped-asset.rb
new file mode 100644
index 000000000..69c31b43c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/bzipped-asset.rb
@@ -0,0 +1,9 @@
+test_cask 'bzipped-asset' do
+ version '1.2.3'
+ sha256 'eaf67b3a62cb9275f96e45d05c70b94bef9ef1dae344083e93eda6b0b388a61c'
+
+ url TestHelper.local_binary_url('bzipped_asset.bz2')
+ homepage 'http://example.com/bzipped-asset'
+
+ app 'bzipped-asset--1.2.3'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/cab-container.rb b/Library/Homebrew/cask/test/support/Casks/cab-container.rb
new file mode 100644
index 000000000..59e25af4e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/cab-container.rb
@@ -0,0 +1,11 @@
+test_cask 'cab-container' do
+ version '1.2.3'
+ sha256 '192d0cf6b727473f9ba0f55cec793ee2a8f7113c5cfe9d49e05a087436c5efe2'
+
+ url TestHelper.local_binary_url('cabcontainer.cab')
+ homepage 'http://example.com/cab-container'
+
+ depends_on formula: 'cabextract'
+
+ app 'cabcontainer/Application.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/gzipped-asset.rb b/Library/Homebrew/cask/test/support/Casks/gzipped-asset.rb
new file mode 100644
index 000000000..20872922c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/gzipped-asset.rb
@@ -0,0 +1,9 @@
+test_cask 'gzipped-asset' do
+ version '1.2.3'
+ sha256 '832506ade94b3e41ecdf2162654eb75891a0749803229e82b2e0420fd1b9e8d2'
+
+ url TestHelper.local_binary_url('gzipped_asset.gz')
+ homepage 'http://example.com/gzipped-asset'
+
+ app 'gzipped-asset--1.2.3'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-multiple.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-multiple.rb
new file mode 100644
index 000000000..c257b05a1
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-multiple.rb
@@ -0,0 +1,13 @@
+test_cask 'invalid-appcast-multiple' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ appcast 'http://example.com/appcast1.xml',
+ checkpoint: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+ appcast 'http://example.com/appcast2.xml',
+ checkpoint: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+ homepage 'http://example.com/invalid-appcast-multiple'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-url.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-url.rb
new file mode 100644
index 000000000..c38702964
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-appcast-url.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-appcast-url' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ appcast 1,
+ checkpoint: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+ homepage 'http://example.com/invalid-appcast-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-conflicts-with-key.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-conflicts-with-key.rb
new file mode 100644
index 000000000..c3cdaf90c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-conflicts-with-key.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-conflicts-with-key' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-conflicts-with-key'
+
+ conflicts_with no_such_key: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-arch-value.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-arch-value.rb
new file mode 100644
index 000000000..68cefaee9
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-arch-value.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-depends-on-arch-value' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-depends-on-arch-value'
+
+ depends_on arch: :no_such_arch
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-key.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-key.rb
new file mode 100644
index 000000000..99b438731
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-key.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-depends-on-key' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-depends-on-key'
+
+ depends_on no_such_key: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-bad-release.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-bad-release.rb
new file mode 100644
index 000000000..fdf4d6faf
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-bad-release.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-depends-on-macos-bad-release' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-depends-on-macos-bad-release'
+
+ depends_on macos: :no_such_release
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb
new file mode 100644
index 000000000..d00960ecf
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-macos-conflicting-forms.rb
@@ -0,0 +1,12 @@
+test_cask 'invalid-depends-on-macos-conflicting-forms' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-depends-on-macos-conflicting-forms'
+
+ depends_on macos: :yosemite
+ depends_on macos: '>= :mavericks'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-x11-value.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-x11-value.rb
new file mode 100644
index 000000000..e15e25933
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-depends-on-x11-value.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-depends-on-x11-value' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-depends-on-x11-value'
+
+ depends_on x11: :no_such_value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb
new file mode 100644
index 000000000..a61b7b045
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-conflicting-keys.rb
@@ -0,0 +1,12 @@
+test_cask 'invalid-gpg-conflicting-keys' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-conflicting-keys'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567',
+ key_url: 'http://example.com/gpg-key-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-id.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-id.rb
new file mode 100644
index 000000000..ba6761311
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-id.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-gpg-key-id' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-key-id'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '012'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-url.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-url.rb
new file mode 100644
index 000000000..7e4fc33c1
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-key-url.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-gpg-key-url' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-key-url'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_url: 1
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-missing-key.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-missing-key.rb
new file mode 100644
index 000000000..339228626
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-missing-key.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-gpg-missing-key' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-missing-keys'
+ gpg 'http://example.com/gpg-signature.asc'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb
new file mode 100644
index 000000000..94125f9d9
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-multiple-stanzas.rb
@@ -0,0 +1,13 @@
+test_cask 'invalid-gpg-multiple-stanzas' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-multiple-stanzas'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-parameter.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-parameter.rb
new file mode 100644
index 000000000..0e08f0c18
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-parameter.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-gpg-parameter' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-type'
+ gpg 'http://example.com/gpg-signature.asc',
+ no_such_parameter: :value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-signature-url.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-signature-url.rb
new file mode 100644
index 000000000..f1cdfcb63
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-signature-url.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-gpg-signature-url' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-signature-url'
+ gpg 1,
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-type.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-type.rb
new file mode 100644
index 000000000..bfb67b3f9
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-gpg-type.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-gpg-type' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/invalid-gpg-type'
+ gpg 'http://example.com/gpg-signature.asc',
+ no_such_parameter: :value
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-format.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-format.rb
new file mode 100644
index 000000000..90ede3b2f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-format.rb
@@ -0,0 +1,9 @@
+test_cask => 'invalid-header-format' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-token-mismatch.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-token-mismatch.rb
new file mode 100644
index 000000000..a69b0d752
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-token-mismatch.rb
@@ -0,0 +1,9 @@
+test_cask 'invalid-header-token-mismatch-this-text-does-not-belong' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-version.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-version.rb
new file mode 100644
index 000000000..d49b83467
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-header-version.rb
@@ -0,0 +1,9 @@
+test_cask 'invalid-header-version' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb
new file mode 100644
index 000000000..5144152f5
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-multiple.rb
@@ -0,0 +1,11 @@
+test_cask 'invalid-license-multiple' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/invalid-license-multiple'
+ license :gpl
+ license :gpl
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb
new file mode 100644
index 000000000..5cb1b08ea
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-license-value.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-license-value' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/invalid-license-value'
+ license :no_such_license
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-stage-only-conflict.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-stage-only-conflict.rb
new file mode 100644
index 000000000..6efd64b22
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-stage-only-conflict.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-stage-only-conflict' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/invalid-stage-only-conflict'
+
+ app 'Transmission.app'
+ stage_only true
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-homepage.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-homepage.rb
new file mode 100644
index 000000000..ee90fa81a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-homepage.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-two-homepage' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+ homepage 'http://www.example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-url.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-url.rb
new file mode 100644
index 000000000..7a4dce7ae
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-url.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-two-url' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ url 'http://example.com/caffeine.zip'
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-version.rb b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-version.rb
new file mode 100644
index 000000000..a3c47c907
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/invalid/invalid-two-version.rb
@@ -0,0 +1,10 @@
+test_cask 'invalid-two-version' do
+ version '1.2.3'
+ version '2.0'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/local-caffeine.rb b/Library/Homebrew/cask/test/support/Casks/local-caffeine.rb
new file mode 100644
index 000000000..fb217cc20
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/local-caffeine.rb
@@ -0,0 +1,9 @@
+test_cask 'local-caffeine' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/local-transmission.rb b/Library/Homebrew/cask/test/support/Casks/local-transmission.rb
new file mode 100644
index 000000000..e0aa719a5
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/local-transmission.rb
@@ -0,0 +1,9 @@
+test_cask 'local-transmission' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/local-transmission'
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/lzma-asset.rb b/Library/Homebrew/cask/test/support/Casks/lzma-asset.rb
new file mode 100644
index 000000000..f69bc7974
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/lzma-asset.rb
@@ -0,0 +1,11 @@
+test_cask 'lzma-asset' do
+ version '1.2.3'
+ sha256 '9d7edb32d02ab9bd9749a5bde8756595ea4cfcb1da02ca11c30fb591d4c1ed85'
+
+ url TestHelper.local_binary_url('lzma-asset.lzma')
+ homepage 'http://example.com/xzipped-asset'
+
+ depends_on formula: 'lzma'
+
+ app 'lzma-asset--1.2.3'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/missing-checksum.rb b/Library/Homebrew/cask/test/support/Casks/missing-checksum.rb
new file mode 100644
index 000000000..3187f6fd2
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/missing-checksum.rb
@@ -0,0 +1,8 @@
+test_cask 'missing-checksum' do
+ version '1.2.3'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/naked-executable.rb b/Library/Homebrew/cask/test/support/Casks/naked-executable.rb
new file mode 100644
index 000000000..03e89e97b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/naked-executable.rb
@@ -0,0 +1,9 @@
+test_cask 'naked-executable' do
+ version '1.2.3'
+ sha256 '306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb'
+
+ url TestHelper.local_binary_url('naked_executable')
+ homepage 'http://example.com/naked-executable'
+
+ container type: :naked
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/naked-pkg.rb b/Library/Homebrew/cask/test/support/Casks/naked-pkg.rb
new file mode 100644
index 000000000..4650ce55d
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/naked-pkg.rb
@@ -0,0 +1,7 @@
+test_cask 'naked-pkg' do
+ version '1.2.3'
+ sha256 '611c50c8a2a2098951d2cd0fd54787ed81b92cd97b4b08bd7cba17f1e1d8e40b'
+
+ url TestHelper.local_binary_url('Naked.pkg')
+ homepage 'http://example.com/naked-pkg'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/nested-app.rb b/Library/Homebrew/cask/test/support/Casks/nested-app.rb
new file mode 100644
index 000000000..77bd04127
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/nested-app.rb
@@ -0,0 +1,11 @@
+test_cask 'nested-app' do
+ version '1.2.3'
+ sha256 '1866dfa833b123bb8fe7fa7185ebf24d28d300d0643d75798bc23730af734216'
+
+ url TestHelper.local_binary_url('NestedApp.dmg.zip')
+ homepage 'http://example.com/nested-app'
+
+ container nested: 'NestedApp.dmg'
+
+ app 'MyNestedApp.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/no-checksum.rb b/Library/Homebrew/cask/test/support/Casks/no-checksum.rb
new file mode 100644
index 000000000..dbe62b02b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/no-checksum.rb
@@ -0,0 +1,9 @@
+test_cask 'no-checksum' do
+ version '1.2.3'
+ sha256 :no_check
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/no-dsl-version.rb b/Library/Homebrew/cask/test/support/Casks/no-dsl-version.rb
new file mode 100644
index 000000000..ee557b1e4
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/no-dsl-version.rb
@@ -0,0 +1,9 @@
+test_cask 'no-dsl-version' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/rar-container.rb b/Library/Homebrew/cask/test/support/Casks/rar-container.rb
new file mode 100644
index 000000000..60c525b60
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/rar-container.rb
@@ -0,0 +1,11 @@
+test_cask 'rar-container' do
+ version '1.2.3'
+ sha256 '35fb13fb13e6aefc38b60486627eff6b6b55b2f99f64bf47938530c6cf9e0a0f'
+
+ url TestHelper.local_binary_url('rarcontainer.rar')
+ homepage 'http://example.com/rar-container'
+
+ depends_on formula: 'unar'
+
+ app 'rarcontainer/Application.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/sevenzip-container.rb b/Library/Homebrew/cask/test/support/Casks/sevenzip-container.rb
new file mode 100644
index 000000000..7f8cfdb4e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/sevenzip-container.rb
@@ -0,0 +1,11 @@
+test_cask 'sevenzip-container' do
+ version '1.2.3'
+ sha256 '1550701e7848fcb94f5b0085cca527083a8662ddeb8c0a7bc5af6bd145797cc1'
+
+ url TestHelper.local_binary_url('sevenzipcontainer.7z')
+ homepage 'http://example.com/sevenzip-container'
+
+ depends_on formula: 'unar'
+
+ app 'sevenzipcontainer/Application.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/stage-only.rb b/Library/Homebrew/cask/test/support/Casks/stage-only.rb
new file mode 100644
index 000000000..25fa7460c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/stage-only.rb
@@ -0,0 +1,9 @@
+test_cask 'stage-only' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/stage-only'
+
+ stage_only true
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/stuffit-container.rb b/Library/Homebrew/cask/test/support/Casks/stuffit-container.rb
new file mode 100644
index 000000000..a42971ff5
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/stuffit-container.rb
@@ -0,0 +1,11 @@
+test_cask 'stuffit-container' do
+ version '1.2.3'
+ sha256 '892b6d49a98c546381d41dec9b0bbc04267ac008d72b99755968d357099993b7'
+
+ url TestHelper.local_binary_url('sheldonmac.sit')
+ homepage 'http://www.tobias-jung.de/seekingprofont/'
+
+ depends_on formula: 'unar'
+
+ artifact 'sheldonmac/v1.0', target: "#{Hbc.appdir}/sheldonmac/v1.0"
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/tarball.rb b/Library/Homebrew/cask/test/support/Casks/tarball.rb
new file mode 100644
index 000000000..3134a2f94
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/tarball.rb
@@ -0,0 +1,9 @@
+test_cask 'tarball' do
+ version '1.2.3'
+ sha256 :no_check
+
+ url TestHelper.local_binary_url('tarball.tgz')
+ homepage 'http://example.com/tarball'
+
+ app 'Tarball.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/test-opera-mail.rb b/Library/Homebrew/cask/test/support/Casks/test-opera-mail.rb
new file mode 100644
index 000000000..afc8387c7
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/test-opera-mail.rb
@@ -0,0 +1,9 @@
+test_cask 'test-opera-mail' do
+ version '1.0'
+ sha256 'afd192e308f8ea8ddb3d426fd6663d97078570417ee78b8e1fa15f515ae3d677'
+
+ url 'http://get-ash-1.opera.com/pub/opera/mail/1.0/mac/Opera-Mail-1.0-1040.i386.dmg'
+ homepage 'http://www.opera.com/computer/mail'
+
+ app 'Opera Mail.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/test-opera.rb b/Library/Homebrew/cask/test/support/Casks/test-opera.rb
new file mode 100644
index 000000000..ec32828f7
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/test-opera.rb
@@ -0,0 +1,9 @@
+test_cask 'test-opera' do
+ version '19.0.1326.47'
+ sha256 '7b91f20ab754f7b3fef8dc346e0393917e11676b74c8f577408841619f76040a'
+
+ url 'http://get.geo.opera.com/pub/opera/desktop/19.0.1326.47/mac/Opera_19.0.1326.47_Setup.dmg'
+ homepage 'http://www.opera.com/'
+
+ app 'Opera.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-accessibility-access.rb b/Library/Homebrew/cask/test/support/Casks/with-accessibility-access.rb
new file mode 100644
index 000000000..1aa7bc8f7
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-accessibility-access.rb
@@ -0,0 +1,11 @@
+test_cask 'with-accessibility-access' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url 'http://example.com/TestCask.dmg'
+ homepage 'http://example.com/'
+
+ accessibility_access true
+
+ app 'TestCask.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-alt-target.rb b/Library/Homebrew/cask/test/support/Casks/with-alt-target.rb
new file mode 100644
index 000000000..6d6456d86
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-alt-target.rb
@@ -0,0 +1,9 @@
+test_cask 'with-alt-target' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app', target: 'AnotherName.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-appcast.rb b/Library/Homebrew/cask/test/support/Casks/with-appcast.rb
new file mode 100644
index 000000000..acfb1565f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-appcast.rb
@@ -0,0 +1,11 @@
+test_cask 'with-appcast' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ appcast 'http://example.com/appcast.xml',
+ checkpoint: '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+ homepage 'http://example.com/with-appcast'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-caveats.rb b/Library/Homebrew/cask/test/support/Casks/with-caveats.rb
new file mode 100644
index 000000000..4412ceb3a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-caveats.rb
@@ -0,0 +1,23 @@
+test_cask 'with-caveats' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+
+ # simple string is evaluated at compile-time
+ caveats <<-EOS.undent
+ Here are some things you might want to know.
+ EOS
+ # do block is evaluated at install-time
+ caveats do
+ "Cask token: #{token}"
+ end
+ # a do block may print and use a DSL
+ caveats do
+ puts 'Custom text via puts followed by DSL-generated text:'
+ path_environment_variable('/custom/path/bin')
+ end
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-conditional-caveats.rb b/Library/Homebrew/cask/test/support/Casks/with-conditional-caveats.rb
new file mode 100644
index 000000000..2690649c3
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-conditional-caveats.rb
@@ -0,0 +1,14 @@
+test_cask 'with-conditional-caveats' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+
+ # a do block may print and use a DSL
+ caveats do
+ puts 'This caveat is conditional' if false # rubocop:disable Lint/LiteralInCondition
+ end
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-conflicts-with.rb b/Library/Homebrew/cask/test/support/Casks/with-conflicts-with.rb
new file mode 100644
index 000000000..789c9839a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-conflicts-with.rb
@@ -0,0 +1,11 @@
+test_cask 'with-conflicts-with' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-conflicts-with'
+
+ conflicts_with formula: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb
new file mode 100644
index 000000000..a257d7bbb
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch-failure.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-arch-failure' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-arch-failure'
+
+ # guarantee mismatched hardware
+ depends_on arch: Hardware::CPU.intel? ? :ppc : :intel
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb
new file mode 100644
index 000000000..9fc5baf1a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-arch.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-arch' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-arch'
+
+ # covers all known hardware; always succeeds
+ depends_on arch: [:ppc, :intel]
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic-helper.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic-helper.rb
new file mode 100644
index 000000000..735289591
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic-helper.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-cask-cyclic-helper' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-cask-cyclic-helper'
+
+ depends_on cask: 'with-depends-on-cask-cyclic'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic.rb
new file mode 100644
index 000000000..776929e83
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-cyclic.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-cask-cyclic' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-cask-cyclic'
+
+ depends_on cask: 'local-caffeine'
+ depends_on cask: 'with-depends-on-cask-cyclic-helper'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-multiple.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-multiple.rb
new file mode 100644
index 000000000..f08e73ac4
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask-multiple.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-cask-multiple' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-cask-multiple'
+
+ depends_on cask: 'local-caffeine'
+ depends_on cask: 'local-transmission'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask.rb
new file mode 100644
index 000000000..013da2379
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-cask.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-cask' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-cask'
+
+ depends_on cask: 'local-transmission'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula-multiple.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula-multiple.rb
new file mode 100644
index 000000000..bdc4e1f8b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula-multiple.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-formula-multiple' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-formula-multiple'
+
+ depends_on formula: 'unar'
+ depends_on formula: 'fileutils'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula.rb
new file mode 100644
index 000000000..3d365a187
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-formula.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-formula' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-formula'
+
+ depends_on formula: 'unar'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-array.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-array.rb
new file mode 100644
index 000000000..4b3b8320e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-array.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-macos-array' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-macos-array'
+
+ # since all OS releases are included, this should always pass
+ depends_on macos: ['10.4', '10.5', '10.6', '10.7', '10.8', '10.9', '10.10', MacOS.version.to_s]
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-comparison.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-comparison.rb
new file mode 100644
index 000000000..448e44a03
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-comparison.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-macos-comparison' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-macos-comparison'
+
+ depends_on macos: '>= 10.4'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-failure.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-failure.rb
new file mode 100644
index 000000000..8e7a9a1d6
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-failure.rb
@@ -0,0 +1,12 @@
+test_cask 'with-depends-on-macos-failure' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-macos-failure'
+
+ # guarantee a mismatched release
+ depends_on macos: MacOS.version.to_s == '10.4' ? '10.5' : '10.4'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-string.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-string.rb
new file mode 100644
index 000000000..1dab7654c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-string.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-macos-string' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-macos-string'
+
+ depends_on macos: MacOS.version.to_s
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-symbol.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-symbol.rb
new file mode 100644
index 000000000..00a99c525
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-macos-symbol.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-macos-symbol' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-macos-symbol'
+
+ depends_on macos: MacOS.version.to_sym
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11-false.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11-false.rb
new file mode 100644
index 000000000..00ea1cef9
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11-false.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-x11-false' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-x11-false'
+
+ depends_on x11: false
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11.rb b/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11.rb
new file mode 100644
index 000000000..234547334
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-depends-on-x11.rb
@@ -0,0 +1,11 @@
+test_cask 'with-depends-on-x11' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-depends-on-x11'
+
+ depends_on x11: true
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-generic-artifact-no-target.rb b/Library/Homebrew/cask/test/support/Casks/with-generic-artifact-no-target.rb
new file mode 100644
index 000000000..5e6eb51b8
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-generic-artifact-no-target.rb
@@ -0,0 +1,9 @@
+test_cask 'with-generic-artifact-no-target' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-generic-artifact'
+
+ artifact 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-generic-artifact.rb b/Library/Homebrew/cask/test/support/Casks/with-generic-artifact.rb
new file mode 100644
index 000000000..87bf43cba
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-generic-artifact.rb
@@ -0,0 +1,9 @@
+test_cask 'with-generic-artifact' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-generic-artifact'
+
+ artifact 'Caffeine.app', target: "#{Hbc.appdir}/Caffeine.app"
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-gpg-key-url.rb b/Library/Homebrew/cask/test/support/Casks/with-gpg-key-url.rb
new file mode 100644
index 000000000..68fa8123a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-gpg-key-url.rb
@@ -0,0 +1,11 @@
+test_cask 'with-gpg-key-url' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-gpg-key-url'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_url: 'http://example.com/gpg-key-url'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-gpg.rb b/Library/Homebrew/cask/test/support/Casks/with-gpg.rb
new file mode 100644
index 000000000..84c29fe65
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-gpg.rb
@@ -0,0 +1,11 @@
+test_cask 'with-gpg' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-gpg'
+ gpg 'http://example.com/gpg-signature.asc',
+ key_id: '01234567'
+
+ app 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-installable.rb b/Library/Homebrew/cask/test/support/Casks/with-installable.rb
new file mode 100644
index 000000000..b32273a6c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-installable.rb
@@ -0,0 +1,20 @@
+test_cask 'with-installable' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] },
+ quit: 'my.fancy.package.app',
+ login_item: 'Fancy',
+ delete: [
+ '/permissible/absolute/path',
+ '~/permissible/path/with/tilde',
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ],
+ rmdir: TestHelper.local_binary_path('empty_directory')
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-installer-manual.rb b/Library/Homebrew/cask/test/support/Casks/with-installer-manual.rb
new file mode 100644
index 000000000..6291d7f88
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-installer-manual.rb
@@ -0,0 +1,9 @@
+test_cask 'with-installer-manual' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ installer manual: 'Caffeine.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-installer-script.rb b/Library/Homebrew/cask/test/support/Casks/with-installer-script.rb
new file mode 100644
index 000000000..3014a3945
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-installer-script.rb
@@ -0,0 +1,15 @@
+test_cask 'with-installer-script' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/with-install-script'
+
+ installer script: '/usr/bin/true',
+ args: ['--flag']
+ # acceptable alternate form
+ installer script: {
+ executable: '/usr/bin/false',
+ args: ['--flag'],
+ }
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-license.rb b/Library/Homebrew/cask/test/support/Casks/with-license.rb
new file mode 100644
index 000000000..ed2572cf2
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-license.rb
@@ -0,0 +1,10 @@
+test_cask 'with-license' do
+ version '2.61'
+ sha256 'd26d7481cf1229f879c05e11cbdf440d99db6d6342f26c73d8ba7861b975532f'
+
+ url TestHelper.local_binary_url('transmission-2.61.dmg')
+ homepage 'http://example.com/with-license'
+ license :gpl
+
+ app 'Transmission.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-macosx-dir.rb b/Library/Homebrew/cask/test/support/Casks/with-macosx-dir.rb
new file mode 100644
index 000000000..24c4ec4dd
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-macosx-dir.rb
@@ -0,0 +1,9 @@
+test_cask 'with-macosx-dir' do
+ version '1.2.3'
+ sha256 '5633c3a0f2e572cbf021507dec78c50998b398c343232bdfc7e26221d0a5db4d'
+
+ url TestHelper.local_binary_url('MyFancyApp.zip')
+ homepage 'http://example.com/MyFancyApp'
+
+ app 'MyFancyApp/MyFancyApp.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-pkgutil-zap.rb b/Library/Homebrew/cask/test/support/Casks/with-pkgutil-zap.rb
new file mode 100644
index 000000000..6440285a0
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-pkgutil-zap.rb
@@ -0,0 +1,13 @@
+test_cask 'with-pkgutil-zap' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap pkgutil: 'my.fancy.package.*',
+ kext: 'my.fancy.package.kernelextension',
+ launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-suite.rb b/Library/Homebrew/cask/test/support/Casks/with-suite.rb
new file mode 100644
index 000000000..594276574
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-suite.rb
@@ -0,0 +1,11 @@
+test_cask 'with-suite' do
+ version '1.2.3'
+ sha256 'd1302a0dc25aff72ad395ed01a830468b92253ffd28269574f3ac0b5eb8aad54'
+
+ url TestHelper.local_binary_url('caffeine_suite.zip')
+ name 'Caffeine'
+ homepage 'http://example.com/with-suite'
+ license :unknown # TODO: change license and remove this comment; ':unknown' is a machine-generated placeholder
+
+ suite 'caffeine_suite'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-two-apps-correct.rb b/Library/Homebrew/cask/test/support/Casks/with-two-apps-correct.rb
new file mode 100644
index 000000000..a0b142528
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-two-apps-correct.rb
@@ -0,0 +1,10 @@
+test_cask 'with-two-apps-correct' do
+ version '1.2.3'
+ sha256 'c0c79dce9511c80603328013dbbcb80b859cc8b9190660b6832b5f0e60d74c82'
+
+ url TestHelper.local_binary_url('2_app_caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app'
+ app 'Caffeine-2.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-two-apps-incorrect.rb b/Library/Homebrew/cask/test/support/Casks/with-two-apps-incorrect.rb
new file mode 100644
index 000000000..0ae37a79c
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-two-apps-incorrect.rb
@@ -0,0 +1,9 @@
+test_cask 'with-two-apps-incorrect' do
+ version '1.2.3'
+ sha256 '9203c30951f9aab41ac294bbeb1dcef7bed401ff0b353dcb34d68af32ea51853'
+
+ url TestHelper.local_binary_url('caffeine.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'Caffeine.app', 'Caffeine.app/Contents/MacOS/Caffeine'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-two-apps-subdir.rb b/Library/Homebrew/cask/test/support/Casks/with-two-apps-subdir.rb
new file mode 100644
index 000000000..61adefab6
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-two-apps-subdir.rb
@@ -0,0 +1,10 @@
+test_cask 'with-two-apps-subdir' do
+ version '1.2.3'
+ sha256 '03edce6992a6095e120dcfadf7049158589ae6f0548c145ed1b1c6f2883f6dca'
+
+ url TestHelper.local_binary_url('2_app_subdir.zip')
+ homepage 'http://example.com/local-caffeine'
+
+ app 'subdir/Caffeine.app'
+ app 'subdir/Caffeine-2.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-delete.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-delete.rb
new file mode 100644
index 000000000..c85b3bd0f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-delete.rb
@@ -0,0 +1,16 @@
+test_cask 'with-uninstall-delete' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall delete: [
+ '/permissible/absolute/path',
+ '~/permissible/path/with/tilde',
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-early-script.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-early-script.rb
new file mode 100644
index 000000000..6fe3842e2
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-early-script.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-early-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-kext.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-kext.rb
new file mode 100644
index 000000000..682ce689e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-kext.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-kext' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall kext: 'my.fancy.package.kernelextension'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-launchctl.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-launchctl.rb
new file mode 100644
index 000000000..0e601b41e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-launchctl.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-launchctl' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyApp.zip')
+ homepage 'http://example.com/fancy'
+
+ app 'Fancy.app'
+
+ uninstall launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-login-item.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-login-item.rb
new file mode 100644
index 000000000..d977b31e3
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-login-item.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-login-item' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall login_item: 'Fancy'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-pkgutil.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-pkgutil.rb
new file mode 100644
index 000000000..773e1e43b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-pkgutil.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-pkgutil' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall pkgutil: 'my.fancy.package.*'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-quit.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-quit.rb
new file mode 100644
index 000000000..88e063c62
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-quit.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-quit' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall quit: 'my.fancy.package.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-rmdir.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-rmdir.rb
new file mode 100644
index 000000000..ce1c66518
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-rmdir.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-rmdir' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall rmdir: TestHelper.local_binary_path('empty_directory')
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-script.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-script.rb
new file mode 100644
index 000000000..975a14442
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-script.rb
@@ -0,0 +1,11 @@
+test_cask 'with-uninstall-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-signal.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-signal.rb
new file mode 100644
index 000000000..808768173
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-signal.rb
@@ -0,0 +1,14 @@
+test_cask 'with-uninstall-signal' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall signal: [
+ ['TERM', 'my.fancy.package.app'],
+ ['KILL', 'my.fancy.package.app'],
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-uninstall-trash.rb b/Library/Homebrew/cask/test/support/Casks/with-uninstall-trash.rb
new file mode 100644
index 000000000..16f174c2d
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-uninstall-trash.rb
@@ -0,0 +1,16 @@
+test_cask 'with-uninstall-trash' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ uninstall trash: [
+ '/permissible/absolute/path',
+ '~/permissible/path/with/tilde',
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-delete.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-delete.rb
new file mode 100644
index 000000000..77d50ffba
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-delete.rb
@@ -0,0 +1,16 @@
+test_cask 'with-zap-delete' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap delete: [
+ '/permissible/absolute/path',
+ '~/permissible/path/with/tilde',
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-early-script.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-early-script.rb
new file mode 100644
index 000000000..299c4d135
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-early-script.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-early-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap early_script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-kext.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-kext.rb
new file mode 100644
index 000000000..d8809b409
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-kext.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-kext' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap kext: 'my.fancy.package.kernelextension'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-launchctl.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-launchctl.rb
new file mode 100644
index 000000000..321e17a78
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-launchctl.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-launchctl' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyApp.zip')
+ homepage 'http://example.com/fancy'
+
+ app 'Fancy.app'
+
+ zap launchctl: 'my.fancy.package.service'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-login-item.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-login-item.rb
new file mode 100644
index 000000000..a7af6ce63
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-login-item.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-login-item' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap login_item: 'Fancy'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-pkgutil.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-pkgutil.rb
new file mode 100644
index 000000000..ded6508cd
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-pkgutil.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-pkgutil' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap pkgutil: 'my.fancy.package.*'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-quit.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-quit.rb
new file mode 100644
index 000000000..0b21221c8
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-quit.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-quit' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap quit: 'my.fancy.package.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-rmdir.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-rmdir.rb
new file mode 100644
index 000000000..f3f799919
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-rmdir.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-rmdir' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap rmdir: TestHelper.local_binary_path('empty_directory')
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-script.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-script.rb
new file mode 100644
index 000000000..9e8ae0d12
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-script.rb
@@ -0,0 +1,11 @@
+test_cask 'with-zap-script' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap script: { executable: 'MyFancyPkg/FancyUninstaller.tool', args: %w[--please] }
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-signal.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-signal.rb
new file mode 100644
index 000000000..7338b67b0
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-signal.rb
@@ -0,0 +1,14 @@
+test_cask 'with-zap-signal' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ zap signal: [
+ ['TERM', 'my.fancy.package.app'],
+ ['KILL', 'my.fancy.package.app'],
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap-trash.rb b/Library/Homebrew/cask/test/support/Casks/with-zap-trash.rb
new file mode 100644
index 000000000..7295b7a23
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap-trash.rb
@@ -0,0 +1,16 @@
+test_cask 'with-zap-trash' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'Fancy.pkg'
+
+ zap trash: [
+ '/permissible/absolute/path',
+ '~/permissible/path/with/tilde',
+ 'impermissible/relative/path',
+ '/another/impermissible/../relative/path',
+ ]
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/with-zap.rb b/Library/Homebrew/cask/test/support/Casks/with-zap.rb
new file mode 100644
index 000000000..752aca019
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/with-zap.rb
@@ -0,0 +1,19 @@
+test_cask 'with-zap' do
+ version '1.2.3'
+ sha256 '8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b'
+
+ url TestHelper.local_binary_url('MyFancyPkg.zip')
+ homepage 'http://example.com/fancy-pkg'
+
+ pkg 'MyFancyPkg/Fancy.pkg'
+
+ uninstall quit: 'my.fancy.package.app.from.uninstall'
+
+ zap script: {
+ executable: 'MyFancyPkg/FancyUninstaller.tool',
+ args: %w[--please],
+ },
+ quit: 'my.fancy.package.app',
+ login_item: 'Fancy',
+ delete: '~/Library/Preferences/my.fancy.app.plist'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/xar-container.rb b/Library/Homebrew/cask/test/support/Casks/xar-container.rb
new file mode 100644
index 000000000..158c4f717
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/xar-container.rb
@@ -0,0 +1,9 @@
+test_cask 'xar-container' do
+ version '1.2.3'
+ sha256 '1418752ac49e859f88590db245015cb2f8b459f619e0c50fd6ff87b902c72ee1'
+
+ url TestHelper.local_binary_url('xarcontainer.xar')
+ homepage 'http://example.com/xar-container'
+
+ app 'xarcontainer/Application.app'
+end
diff --git a/Library/Homebrew/cask/test/support/Casks/xzipped-asset.rb b/Library/Homebrew/cask/test/support/Casks/xzipped-asset.rb
new file mode 100644
index 000000000..badb252ee
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/Casks/xzipped-asset.rb
@@ -0,0 +1,11 @@
+test_cask 'xzipped-asset' do
+ version '1.2.3'
+ sha256 '839263f474edde1d54a9101606e6f0dc9d963acc93f6dcc5af8d10ebc3187c02'
+
+ url TestHelper.local_binary_url('xzipped-asset.xz')
+ homepage 'http://example.com/xzipped-asset'
+
+ depends_on formula: 'xz'
+
+ app 'xzipped-asset--1.2.3'
+end
diff --git a/Library/Homebrew/cask/test/support/binaries/2_app_caffeine.zip b/Library/Homebrew/cask/test/support/binaries/2_app_caffeine.zip
new file mode 100755
index 000000000..a678f7c11
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/2_app_caffeine.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/2_app_subdir.zip b/Library/Homebrew/cask/test/support/binaries/2_app_subdir.zip
new file mode 100755
index 000000000..27637a731
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/2_app_subdir.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/GMDesk-1.01.air b/Library/Homebrew/cask/test/support/binaries/GMDesk-1.01.air
new file mode 100644
index 000000000..215cd2b8b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/GMDesk-1.01.air
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/MyFancyApp.zip b/Library/Homebrew/cask/test/support/binaries/MyFancyApp.zip
new file mode 100644
index 000000000..ba09ee681
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/MyFancyApp.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/MyFancyPkg.zip b/Library/Homebrew/cask/test/support/binaries/MyFancyPkg.zip
new file mode 100644
index 000000000..ec4f97f07
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/MyFancyPkg.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/Naked.pkg b/Library/Homebrew/cask/test/support/binaries/Naked.pkg
new file mode 100644
index 000000000..274f27e7a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/Naked.pkg
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/NestedApp.dmg.zip b/Library/Homebrew/cask/test/support/binaries/NestedApp.dmg.zip
new file mode 100644
index 000000000..ae6686c7e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/NestedApp.dmg.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/bzipped_asset.bz2 b/Library/Homebrew/cask/test/support/binaries/bzipped_asset.bz2
new file mode 100644
index 000000000..6ec60f31f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/bzipped_asset.bz2
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/cabcontainer.cab b/Library/Homebrew/cask/test/support/binaries/cabcontainer.cab
new file mode 100644
index 000000000..f1dec52dc
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/cabcontainer.cab
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/caffeine.zip b/Library/Homebrew/cask/test/support/binaries/caffeine.zip
new file mode 100644
index 000000000..74aca21db
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/caffeine.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/caffeine_suite.zip b/Library/Homebrew/cask/test/support/binaries/caffeine_suite.zip
new file mode 100644
index 000000000..7fa5c958e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/caffeine_suite.zip
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/empty_directory/.gitignore b/Library/Homebrew/cask/test/support/binaries/empty_directory/.gitignore
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/empty_directory/.gitignore
diff --git a/Library/Homebrew/cask/test/support/binaries/gzipped_asset.gz b/Library/Homebrew/cask/test/support/binaries/gzipped_asset.gz
new file mode 100644
index 000000000..1ff300b4b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/gzipped_asset.gz
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/lzma-asset.lzma b/Library/Homebrew/cask/test/support/binaries/lzma-asset.lzma
new file mode 100644
index 000000000..2ff7ccee7
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/lzma-asset.lzma
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/naked_executable b/Library/Homebrew/cask/test/support/binaries/naked_executable
new file mode 100755
index 000000000..039e4d006
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/naked_executable
@@ -0,0 +1,2 @@
+#!/bin/sh
+exit 0
diff --git a/Library/Homebrew/cask/test/support/binaries/rarcontainer.rar b/Library/Homebrew/cask/test/support/binaries/rarcontainer.rar
new file mode 100644
index 000000000..988699306
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/rarcontainer.rar
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/sevenzipcontainer.7z b/Library/Homebrew/cask/test/support/binaries/sevenzipcontainer.7z
new file mode 100644
index 000000000..226f620cd
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/sevenzipcontainer.7z
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/sheldonmac.sit b/Library/Homebrew/cask/test/support/binaries/sheldonmac.sit
new file mode 100644
index 000000000..8814fc31e
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/sheldonmac.sit
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/tarball.tgz b/Library/Homebrew/cask/test/support/binaries/tarball.tgz
new file mode 100644
index 000000000..0a9fb5695
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/tarball.tgz
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/transmission-2.61.dmg b/Library/Homebrew/cask/test/support/binaries/transmission-2.61.dmg
new file mode 100644
index 000000000..b9629f837
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/transmission-2.61.dmg
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/xarcontainer.xar b/Library/Homebrew/cask/test/support/binaries/xarcontainer.xar
new file mode 100644
index 000000000..bd37cd4d6
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/xarcontainer.xar
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/binaries/xzipped-asset.xz b/Library/Homebrew/cask/test/support/binaries/xzipped-asset.xz
new file mode 100644
index 000000000..74db22090
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/binaries/xzipped-asset.xz
Binary files differ
diff --git a/Library/Homebrew/cask/test/support/cleanup.rb b/Library/Homebrew/cask/test/support/cleanup.rb
new file mode 100644
index 000000000..0cb9c02fa
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/cleanup.rb
@@ -0,0 +1,12 @@
+module Hbc::CleanupHooks
+ def after_teardown
+ super
+ Hbc.installed.each do |cask|
+ Hbc::Installer.new(cask).purge_versioned_files
+ end
+ end
+end
+
+class MiniTest::Spec
+ include Hbc::CleanupHooks
+end
diff --git a/Library/Homebrew/cask/test/support/fake_dirs.rb b/Library/Homebrew/cask/test/support/fake_dirs.rb
new file mode 100644
index 000000000..89612f850
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/fake_dirs.rb
@@ -0,0 +1,29 @@
+# wire in a set of fake link dirs per-test
+module FakeDirHooks
+ DIRS = [:appdir, :qlplugindir, :binarydir].freeze
+
+ def before_setup
+ super
+
+ @canned_dirs = {}
+
+ DIRS.each do |dir_name|
+ dir = Hbc.homebrew_prefix.join("#{dir_name}-#{Time.now.to_i}-#{rand(1024)}")
+ dir.mkpath
+ Hbc.send("#{dir_name}=", dir)
+ @canned_dirs[:dir_name] = dir
+ end
+ end
+
+ def after_teardown
+ super
+
+ @canned_dirs.each_value do |dir|
+ dir.rmtree if dir.exist?
+ end
+ end
+end
+
+class MiniTest::Spec
+ include FakeDirHooks
+end
diff --git a/Library/Homebrew/cask/test/support/fake_fetcher.rb b/Library/Homebrew/cask/test/support/fake_fetcher.rb
new file mode 100644
index 000000000..a49a89f7f
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/fake_fetcher.rb
@@ -0,0 +1,35 @@
+class Hbc::FakeFetcher
+ def self.fake_response_for(url, response)
+ @responses[url] = response
+ end
+
+ def self.head(url)
+ @responses ||= {}
+ raise("no response faked for #{url.inspect}") unless @responses.key?(url)
+ @responses[url]
+ end
+
+ def self.init
+ @responses = {}
+ end
+
+ def self.clear
+ @responses = {}
+ end
+end
+
+module FakeFetcherHooks
+ def before_setup
+ super
+ Hbc::FakeFetcher.init
+ end
+
+ def after_teardown
+ super
+ Hbc::FakeFetcher.clear
+ end
+end
+
+class MiniTest::Spec
+ include FakeFetcherHooks
+end
diff --git a/Library/Homebrew/cask/test/support/fake_system_command.rb b/Library/Homebrew/cask/test/support/fake_system_command.rb
new file mode 100644
index 000000000..e19330fd0
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/fake_system_command.rb
@@ -0,0 +1,73 @@
+class Hbc::FakeSystemCommand
+ def self.responses
+ @responses ||= {}
+ end
+
+ def self.expectations
+ @expectations ||= {}
+ end
+
+ def self.system_calls
+ @system_calls ||= Hash.new(0)
+ end
+
+ def self.clear
+ @responses = nil
+ @expectations = nil
+ @system_calls = nil
+ end
+
+ def self.stubs_command(command, response = "")
+ responses[command] = response
+ end
+
+ def self.expects_command(command, response = "", times = 1)
+ stubs_command(command, response)
+ expectations[command] = times
+ end
+
+ def self.expect_and_pass_through(command, times = 1)
+ pass_through = ->(cmd, opts) { Hbc::SystemCommand.run(cmd, opts) }
+ expects_command(command, pass_through, times)
+ end
+
+ def self.verify_expectations!
+ expectations.each do |command, times|
+ unless system_calls[command] == times
+ raise("expected #{command.inspect} to be run #{times} times, but got #{system_calls[command]}")
+ end
+ end
+ end
+
+ def self.run(command_string, options = {})
+ command = Hbc::SystemCommand.new(command_string, options).command
+ unless responses.key?(command)
+ raise("no response faked for #{command.inspect}, faked responses are: #{responses.inspect}")
+ end
+ system_calls[command] += 1
+
+ response = responses[command]
+ if response.respond_to?(:call)
+ response.call(command_string, options)
+ else
+ Hbc::SystemCommand::Result.new(command, response, "", 0)
+ end
+ end
+
+ def self.run!(command, options = {})
+ run(command, options.merge(must_succeed: true))
+ end
+end
+
+module FakeSystemCommandHooks
+ def after_teardown
+ super
+ Hbc::FakeSystemCommand.verify_expectations!
+ ensure
+ Hbc::FakeSystemCommand.clear
+ end
+end
+
+class MiniTest::Spec
+ include FakeSystemCommandHooks
+end
diff --git a/Library/Homebrew/cask/test/support/never_sudo_system_command.rb b/Library/Homebrew/cask/test/support/never_sudo_system_command.rb
new file mode 100644
index 000000000..50f510a7a
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/never_sudo_system_command.rb
@@ -0,0 +1,5 @@
+class Hbc::NeverSudoSystemCommand < Hbc::SystemCommand
+ def self.run(command, options = {})
+ super(command, options.merge(sudo: false))
+ end
+end
diff --git a/Library/Homebrew/cask/test/support/shared_examples.rb b/Library/Homebrew/cask/test/support/shared_examples.rb
new file mode 100644
index 000000000..e846af404
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/shared_examples.rb
@@ -0,0 +1,21 @@
+# Adapted from https://gist.github.com/jodosha/1560208
+MiniTest::Spec.class_eval do
+ def self.shared_examples
+ @shared_examples ||= {}
+ end
+end
+
+module MiniTest::Spec::SharedExamples
+ def shared_examples_for(desc, &block)
+ MiniTest::Spec.shared_examples[desc] = block
+ end
+
+ def it_behaves_like(desc, *args, &block)
+ instance_exec(*args, &MiniTest::Spec.shared_examples[desc])
+ instance_eval(&block) if block_given?
+ end
+end
+
+Object.class_eval do
+ include(MiniTest::Spec::SharedExamples)
+end
diff --git a/Library/Homebrew/cask/test/support/shared_examples/dsl_base.rb b/Library/Homebrew/cask/test/support/shared_examples/dsl_base.rb
new file mode 100644
index 000000000..28115bb4b
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/shared_examples/dsl_base.rb
@@ -0,0 +1,23 @@
+require "test_helper"
+
+shared_examples_for Hbc::DSL::Base do
+ it "supports the token method" do
+ dsl.token.must_equal cask.token
+ end
+
+ it "supports the version method" do
+ dsl.version.must_equal cask.version
+ end
+
+ it "supports the caskroom_path method" do
+ dsl.caskroom_path.must_equal cask.caskroom_path
+ end
+
+ it "supports the staged_path method" do
+ dsl.staged_path.must_equal cask.staged_path
+ end
+
+ it "supports the appdir method" do
+ dsl.appdir.must_equal cask.appdir
+ end
+end
diff --git a/Library/Homebrew/cask/test/support/shared_examples/staged.rb b/Library/Homebrew/cask/test/support/shared_examples/staged.rb
new file mode 100644
index 000000000..ef4ff0341
--- /dev/null
+++ b/Library/Homebrew/cask/test/support/shared_examples/staged.rb
@@ -0,0 +1,109 @@
+require "test_helper"
+
+shared_examples_for Hbc::Staged do
+ let(:fake_pathname_exists) {
+ fake_pathname = Pathname("/path/to/file/that/exists")
+ fake_pathname.stubs(exist?: true, expand_path: fake_pathname)
+ fake_pathname
+ }
+
+ let(:fake_pathname_does_not_exist) {
+ fake_pathname = Pathname("/path/to/file/that/does/not/exist")
+ fake_pathname.stubs(exist?: false, expand_path: fake_pathname)
+ fake_pathname
+ }
+
+ it "can run system commands with list-form arguments" do
+ Hbc::FakeSystemCommand.expects_command(
+ ["echo", "homebrew-cask", "rocks!"]
+ )
+ staged.system_command("echo", args: ["homebrew-cask", "rocks!"])
+ end
+
+ it "can get the Info.plist file for the primary app" do
+ staged.info_plist_file.to_s.must_include Hbc.appdir.join("TestCask.app/Contents/Info.plist")
+ end
+
+ it "can execute commands on the Info.plist file" do
+ staged.stubs(bundle_identifier: "com.example.BasicCask")
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/libexec/PlistBuddy", "-c", "Print CFBundleIdentifier", staged.info_plist_file]
+ )
+ staged.plist_exec("Print CFBundleIdentifier")
+ end
+
+ it "can set a key in the Info.plist file" do
+ staged.stubs(bundle_identifier: "com.example.BasicCask")
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/libexec/PlistBuddy", "-c", "Set :JVMOptions:JVMVersion 1.6+", staged.info_plist_file]
+ )
+ staged.plist_set(":JVMOptions:JVMVersion", "1.6+")
+ end
+
+ it "can set the permissions of a file" do
+ fake_pathname = fake_pathname_exists
+ staged.stubs(Pathname: fake_pathname)
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/bin/sudo", "-E", "--", "/bin/chmod", "-R", "--", "777", fake_pathname]
+ )
+ staged.set_permissions(fake_pathname.to_s, "777")
+ end
+
+ it "can set the permissions of multiple files" do
+ fake_pathname = fake_pathname_exists
+ staged.stubs(:Pathname).returns(fake_pathname)
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/bin/sudo", "-E", "--", "/bin/chmod", "-R", "--", "777", fake_pathname, fake_pathname]
+ )
+ staged.set_permissions([fake_pathname.to_s, fake_pathname.to_s], "777")
+ end
+
+ it "cannot set the permissions of a file that does not exist" do
+ fake_pathname = fake_pathname_does_not_exist
+ staged.stubs(Pathname: fake_pathname)
+ staged.set_permissions(fake_pathname.to_s, "777")
+ end
+
+ it "can set the ownership of a file" do
+ staged.stubs(current_user: "fake_user")
+ fake_pathname = fake_pathname_exists
+ staged.stubs(Pathname: fake_pathname)
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname]
+ )
+ staged.set_ownership(fake_pathname.to_s)
+ end
+
+ it "can set the ownership of multiple files" do
+ staged.stubs(current_user: "fake_user")
+ fake_pathname = fake_pathname_exists
+ staged.stubs(Pathname: fake_pathname)
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "fake_user:staff", fake_pathname, fake_pathname]
+ )
+ staged.set_ownership([fake_pathname.to_s, fake_pathname.to_s])
+ end
+
+ it "can set the ownership of a file with a different user and group" do
+ fake_pathname = fake_pathname_exists
+ staged.stubs(Pathname: fake_pathname)
+
+ Hbc::FakeSystemCommand.expects_command(
+ ["/usr/bin/sudo", "-E", "--", "/usr/sbin/chown", "-R", "--", "other_user:other_group", fake_pathname]
+ )
+ staged.set_ownership(fake_pathname.to_s, user: "other_user", group: "other_group")
+ end
+
+ it "cannot set the ownership of a file that does not exist" do
+ staged.stubs(current_user: "fake_user")
+ fake_pathname = fake_pathname_does_not_exist
+ staged.stubs(Pathname: fake_pathname)
+ staged.set_ownership(fake_pathname.to_s)
+ end
+end