Merge pull request #3145 from reitermarkus/cask-search

Make `brew cask search` spec deterministic.
This commit is contained in:
Markus Reiter 2017-09-10 22:53:53 +02:00 committed by GitHub
commit 8f8f0f0a9e

View File

@ -4,6 +4,8 @@ describe Hbc::CLI::Search, :cask do
end end
it "lists the available Casks that match the search term" do it "lists the available Casks that match the search term" do
allow(GitHub).to receive(:search_code).and_return([])
expect { expect {
Hbc::CLI::Search.run("local") Hbc::CLI::Search.run("local")
}.to output(<<-EOS.undent).to_stdout.as_tty }.to output(<<-EOS.undent).to_stdout.as_tty
@ -14,6 +16,8 @@ describe Hbc::CLI::Search, :cask do
end end
it "outputs a plain list when stdout is not a TTY" do it "outputs a plain list when stdout is not a TTY" do
allow(GitHub).to receive(:search_code).and_return([])
expect { expect {
Hbc::CLI::Search.run("local") Hbc::CLI::Search.run("local")
}.to output(<<-EOS.undent).to_stdout }.to output(<<-EOS.undent).to_stdout
@ -24,6 +28,7 @@ describe Hbc::CLI::Search, :cask do
it "returns matches even when online search failed" do it "returns matches even when online search failed" do
allow(GitHub).to receive(:search_code).and_raise(GitHub::Error.new("reason")) allow(GitHub).to receive(:search_code).and_raise(GitHub::Error.new("reason"))
expect { expect {
Hbc::CLI::Search.run("local") Hbc::CLI::Search.run("local")
}.to output(<<-EOS.undent).to_stdout }.to output(<<-EOS.undent).to_stdout