diff options
| author | Alexey Alekhin | 2017-08-26 01:54:24 +0200 |
|---|---|---|
| committer | Alexey Alekhin | 2017-08-26 01:54:24 +0200 |
| commit | 3b7e0d8dbe3d9652b6d9a81f01bc3e68479b17bc (patch) | |
| tree | ea34b07e51481e62d125924b6f9913ee9f957604 /Library | |
| parent | 2cc6ef48ff6927db568616d2099b9d8163b90652 (diff) | |
| download | brew-3b7e0d8dbe3d9652b6d9a81f01bc3e68479b17bc.tar.bz2 | |
Added tests for cask search with online search failure
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/test/cask/cli/search_spec.rb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/Library/Homebrew/test/cask/cli/search_spec.rb b/Library/Homebrew/test/cask/cli/search_spec.rb index e237ad464..e7065404d 100644 --- a/Library/Homebrew/test/cask/cli/search_spec.rb +++ b/Library/Homebrew/test/cask/cli/search_spec.rb @@ -22,16 +22,29 @@ describe Hbc::CLI::Search, :cask do EOS end + it "returns matches even when online search failed" do + allow(GitHub).to receive(:search_code).and_raise(GitHub::Error.new("reason")) + expect { + Hbc::CLI::Search.run("local") + }.to output(<<-EOS.undent).to_stdout + local-caffeine + local-transmission + EOS + .and output(/^Error: reason\n/).to_stderr + end + it "shows that there are no Casks matching a search term that did not result in anything" do expect { Hbc::CLI::Search.run("foo-bar-baz") }.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout.as_tty end - it "lists all available Casks with no search term" do + it "lists all Casks available offline with no search term" do + allow(GitHub).to receive(:search_code).and_raise(GitHub::Error.new("reason")) expect { Hbc::CLI::Search.run }.to output(/local-caffeine/).to_stdout.as_tty + .and not_to_output.to_stderr end it "ignores hyphens in search terms" do |
