aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cask/cli/create_spec.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-10-04 11:40:03 +0200
committerGitHub2017-10-04 11:40:03 +0200
commit67afb6ea6888a41313c167d68cab514d6d94a39b (patch)
treea45ebbefb87e84f30675b6faa6e3016b3a5be2a5 /Library/Homebrew/test/cask/cli/create_spec.rb
parent7ee86cfe770bc19bf65509abf948ce363de90c59 (diff)
parent643b2a168c6c5b2f21b141ec385fc49d29c41718 (diff)
downloadbrew-67afb6ea6888a41313c167d68cab514d6d94a39b.tar.bz2
Merge pull request #3260 from reitermarkus/cask-cli-specs
Refactor `cask/cli` specs.
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