aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/cli/create_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/test/cask/cli/create_spec.rb')
-rw-r--r--Library/Homebrew/test/cask/cli/create_spec.rb28
1 files changed, 6 insertions, 22 deletions
diff --git a/Library/Homebrew/test/cask/cli/create_spec.rb b/Library/Homebrew/test/cask/cli/create_spec.rb
index 17d426f78..60c03db75 100644
--- a/Library/Homebrew/test/cask/cli/create_spec.rb
+++ b/Library/Homebrew/test/cask/cli/create_spec.rb
@@ -1,3 +1,6 @@
+require_relative "shared_examples/requires_cask_token"
+require_relative "shared_examples/invalid_option"
+
describe Hbc::CLI::Create, :cask do
around(:each) do |example|
begin
@@ -13,6 +16,9 @@ describe Hbc::CLI::Create, :cask do
allow_any_instance_of(described_class).to receive(:exec_editor)
end
+ it_behaves_like "a command that requires a Cask token"
+ it_behaves_like "a command that handles invalid options"
+
it "opens the editor for the specified Cask" do
command = described_class.new("new-cask")
expect(command).to receive(:exec_editor).with(Hbc::CaskLoader.path("new-cask"))
@@ -53,26 +59,4 @@ describe Hbc::CLI::Create, :cask do
expect(command).to receive(:exec_editor).with(Hbc::CaskLoader.path("local-caff"))
command.run
end
-
- describe "when no Cask is specified" do
- it "raises an exception" do
- expect {
- described_class.run
- }.to raise_error(Hbc::CaskUnspecifiedError)
- end
- end
-
- context "when an invalid option is specified" do
- it "raises an exception when no Cask is specified" do
- expect {
- described_class.run("--notavalidoption")
- }.to raise_error(/invalid option/)
- end
-
- it "raises an exception" do
- expect {
- described_class.run("--notavalidoption", "yet-another-cask")
- }.to raise_error(/invalid option/)
- end
- end
end