diff options
| author | Markus Reiter | 2017-11-03 13:23:08 +0100 |
|---|---|---|
| committer | GitHub | 2017-11-03 13:23:08 +0100 |
| commit | 4eeac6f884a72bd16ddbab03db22f293e18f02bc (patch) | |
| tree | ea452fbb6bbce34c08176f59987cdaf93a2cf0e8 /Library/Homebrew/test/cask | |
| parent | 0ac55875c5bd80687e7418995d6d9a485a8c032f (diff) | |
| parent | eaae7f3a5b7dcce0d6c4a3238547996e886b7144 (diff) | |
| download | brew-4eeac6f884a72bd16ddbab03db22f293e18f02bc.tar.bz2 | |
Merge pull request #3389 from amyspark/hacktoberfest-single-zap
Check that a single uninstall_* and zap stanza is defined
Diffstat (limited to 'Library/Homebrew/test/cask')
| -rw-r--r-- | Library/Homebrew/test/cask/audit_spec.rb | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/audit_spec.rb b/Library/Homebrew/test/cask/audit_spec.rb index 7e140acb2..ec051c138 100644 --- a/Library/Homebrew/test/cask/audit_spec.rb +++ b/Library/Homebrew/test/cask/audit_spec.rb @@ -91,6 +91,120 @@ describe Hbc::Audit, :cask do end end + describe "preflight stanza checks" do + let(:error_msg) { "only a single preflight stanza is allowed" } + + context "when the cask has no preflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one preflight stanza" do + let(:cask_token) { "with-preflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple preflight stanzas" do + let(:cask_token) { "with-preflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_postflight stanza checks" do + let(:error_msg) { "only a single postflight stanza is allowed" } + + context "when the cask has no postflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one postflight stanza" do + let(:cask_token) { "with-postflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple postflight stanzas" do + let(:cask_token) { "with-postflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall stanza checks" do + let(:error_msg) { "only a single uninstall stanza is allowed" } + + context "when the cask has no uninstall stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall stanza" do + let(:cask_token) { "with-uninstall-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall stanzas" do + let(:cask_token) { "with-uninstall-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_preflight stanza checks" do + let(:error_msg) { "only a single uninstall_preflight stanza is allowed" } + + context "when the cask has no uninstall_preflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall_preflight stanza" do + let(:cask_token) { "with-uninstall-preflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall_preflight stanzas" do + let(:cask_token) { "with-uninstall-preflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "uninstall_postflight stanza checks" do + let(:error_msg) { "only a single uninstall_postflight stanza is allowed" } + + context "when the cask has no uninstall_postflight stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one uninstall_postflight stanza" do + let(:cask_token) { "with-uninstall-postflight" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple uninstall_postflight stanzas" do + let(:cask_token) { "with-uninstall-postflight-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + + describe "zap stanza checks" do + let(:error_msg) { "only a single zap stanza is allowed" } + + context "when the cask has no zap stanza" do + let(:cask_token) { "with-uninstall-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has only one zap stanza" do + let(:cask_token) { "with-zap-rmdir" } + it { should_not warn_with(error_msg) } + end + + context "when the cask has multiple zap stanzas" do + let(:cask_token) { "with-zap-multi" } + it { is_expected.to warn_with(error_msg) } + end + end + describe "version checks" do let(:error_msg) { "you should use version :latest instead of version 'latest'" } |
