diff options
| author | Markus Reiter | 2017-10-03 10:49:58 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-10-03 10:56:40 +0200 |
| commit | 643b2a168c6c5b2f21b141ec385fc49d29c41718 (patch) | |
| tree | ae9f32f7283806d2e1878bb4aa8932b2fbacb2de /Library/Homebrew/test/cask/cli/shared_examples | |
| parent | ec0d8fa7ba18f4fe05c5241258502c8db332b13d (diff) | |
| download | brew-643b2a168c6c5b2f21b141ec385fc49d29c41718.tar.bz2 | |
Refactor `cask/cli` specs.
Diffstat (limited to 'Library/Homebrew/test/cask/cli/shared_examples')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/shared_examples/invalid_option.rb | 15 | ||||
| -rw-r--r-- | Library/Homebrew/test/cask/cli/shared_examples/requires_cask_token.rb | 9 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/test/cask/cli/shared_examples/invalid_option.rb b/Library/Homebrew/test/cask/cli/shared_examples/invalid_option.rb new file mode 100644 index 000000000..12a05be92 --- /dev/null +++ b/Library/Homebrew/test/cask/cli/shared_examples/invalid_option.rb @@ -0,0 +1,15 @@ +shared_examples "a command that handles invalid options" do + context "when an invalid option is specified" do + it "raises an exception when no Cask is specified" do + expect { + described_class.run("--not-a-valid-option") + }.to raise_error("invalid option: --not-a-valid-option") + end + + it "raises an exception when a Cask is specified" do + expect { + described_class.run("--not-a-valid-option", "basic-cask") + }.to raise_error("invalid option: --not-a-valid-option") + end + end +end diff --git a/Library/Homebrew/test/cask/cli/shared_examples/requires_cask_token.rb b/Library/Homebrew/test/cask/cli/shared_examples/requires_cask_token.rb new file mode 100644 index 000000000..dc1e471e5 --- /dev/null +++ b/Library/Homebrew/test/cask/cli/shared_examples/requires_cask_token.rb @@ -0,0 +1,9 @@ +shared_examples "a command that requires a Cask token" do + context "when no Cask is specified" do + it "raises an exception " do + expect { + described_class.run + }.to raise_error(Hbc::CaskUnspecifiedError, "This command requires a Cask token.") + end + end +end |
