diff options
| author | Markus Reiter | 2017-10-04 11:40:03 +0200 |
|---|---|---|
| committer | GitHub | 2017-10-04 11:40:03 +0200 |
| commit | 67afb6ea6888a41313c167d68cab514d6d94a39b (patch) | |
| tree | a45ebbefb87e84f30675b6faa6e3016b3a5be2a5 /Library/Homebrew/test/cask/cli/info_spec.rb | |
| parent | 7ee86cfe770bc19bf65509abf948ce363de90c59 (diff) | |
| parent | 643b2a168c6c5b2f21b141ec385fc49d29c41718 (diff) | |
| download | brew-67afb6ea6888a41313c167d68cab514d6d94a39b.tar.bz2 | |
Merge pull request #3260 from reitermarkus/cask-cli-specs
Refactor `cask/cli` specs.
Diffstat (limited to 'Library/Homebrew/test/cask/cli/info_spec.rb')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/info_spec.rb | 40 |
1 files changed, 12 insertions, 28 deletions
diff --git a/Library/Homebrew/test/cask/cli/info_spec.rb b/Library/Homebrew/test/cask/cli/info_spec.rb index df02bb1e5..e24eead11 100644 --- a/Library/Homebrew/test/cask/cli/info_spec.rb +++ b/Library/Homebrew/test/cask/cli/info_spec.rb @@ -1,7 +1,13 @@ +require_relative "shared_examples/requires_cask_token" +require_relative "shared_examples/invalid_option" + describe Hbc::CLI::Info, :cask do + it_behaves_like "a command that requires a Cask token" + it_behaves_like "a command that handles invalid options" + it "displays some nice info about the specified Cask" do expect { - Hbc::CLI::Info.run("local-caffeine") + described_class.run("local-caffeine") }.to output(<<-EOS.undent).to_stdout local-caffeine: 1.2.3 http://example.com/local-caffeine @@ -38,20 +44,14 @@ describe Hbc::CLI::Info, :cask do it "displays the info" do expect { - Hbc::CLI::Info.run("local-caffeine", "local-transmission") + described_class.run("local-caffeine", "local-transmission") }.to output(expected_output).to_stdout end - - it "throws away stray options" do - expect { - Hbc::CLI::Info.run("--notavalidoption", "local-caffeine", "local-transmission") - }.to raise_error(/invalid option/) - end end it "should print caveats if the Cask provided one" do expect { - Hbc::CLI::Info.run("with-caveats") + described_class.run("with-caveats") }.to output(<<-EOS.undent).to_stdout with-caveats: 1.2.3 http://example.com/local-caffeine @@ -77,7 +77,7 @@ describe Hbc::CLI::Info, :cask do it 'should not print "Caveats" section divider if the caveats block has no output' do expect { - Hbc::CLI::Info.run("with-conditional-caveats") + described_class.run("with-conditional-caveats") }.to output(<<-EOS.undent).to_stdout with-conditional-caveats: 1.2.3 http://example.com/local-caffeine @@ -92,7 +92,7 @@ describe Hbc::CLI::Info, :cask do it "prints languages specified in the Cask" do expect { - Hbc::CLI::Info.run("with-languages") + described_class.run("with-languages") }.to output(<<-EOS.undent).to_stdout with-languages: 1.2.3 http://example.com/local-caffeine @@ -109,7 +109,7 @@ describe Hbc::CLI::Info, :cask do it 'does not print "Languages" section divider if the languages block has no output' do expect { - Hbc::CLI::Info.run("without-languages") + described_class.run("without-languages") }.to output(<<-EOS.undent).to_stdout without-languages: 1.2.3 http://example.com/local-caffeine @@ -121,20 +121,4 @@ describe Hbc::CLI::Info, :cask do Caffeine.app (App) EOS end - - describe "when no Cask is specified" do - it "raises an exception" do - expect { - Hbc::CLI::Info.run - }.to raise_error(Hbc::CaskUnspecifiedError) - end - end - - describe "when no Cask is specified, but an invalid option" do - it "raises an exception" do - expect { - Hbc::CLI::Info.run("--notavalidoption") - }.to raise_error(/invalid option/) - end - end end |
