Added tests for cask search with online search failure
This commit is contained in:
parent
2cc6ef48ff
commit
3b7e0d8dbe
@ -22,16 +22,29 @@ describe Hbc::CLI::Search, :cask do
|
|||||||
EOS
|
EOS
|
||||||
end
|
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
|
it "shows that there are no Casks matching a search term that did not result in anything" do
|
||||||
expect {
|
expect {
|
||||||
Hbc::CLI::Search.run("foo-bar-baz")
|
Hbc::CLI::Search.run("foo-bar-baz")
|
||||||
}.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout.as_tty
|
}.to output("No Cask found for \"foo-bar-baz\".\n").to_stdout.as_tty
|
||||||
end
|
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 {
|
expect {
|
||||||
Hbc::CLI::Search.run
|
Hbc::CLI::Search.run
|
||||||
}.to output(/local-caffeine/).to_stdout.as_tty
|
}.to output(/local-caffeine/).to_stdout.as_tty
|
||||||
|
.and not_to_output.to_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
it "ignores hyphens in search terms" do
|
it "ignores hyphens in search terms" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user