2017-02-21 05:13:05 +01:00
|
|
|
require "cmd/search"
|
|
|
|
|
|
|
|
describe Homebrew do
|
2017-04-24 14:11:04 +01:00
|
|
|
specify "#search_taps" do
|
2017-08-31 22:29:36 -07:00
|
|
|
# Otherwise the tested method returns [], regardless of our stub
|
|
|
|
ENV.delete("HOMEBREW_NO_GITHUB_API")
|
|
|
|
|
2017-02-21 05:13:05 +01:00
|
|
|
json_response = {
|
2017-04-24 14:11:04 +01:00
|
|
|
"items" => [
|
2017-02-21 05:13:05 +01:00
|
|
|
{
|
2017-04-24 14:11:04 +01:00
|
|
|
"path" => "Formula/some-formula.rb",
|
|
|
|
"repository" => {
|
2017-04-24 19:31:21 +02:00
|
|
|
"full_name" => "Homebrew/homebrew-foo",
|
2017-04-24 14:11:04 +01:00
|
|
|
},
|
2017-02-21 05:13:05 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
}
|
|
|
|
|
|
|
|
allow(GitHub).to receive(:open).and_yield(json_response)
|
|
|
|
|
2017-04-24 14:11:04 +01:00
|
|
|
expect(described_class.search_taps("some-formula"))
|
|
|
|
.to match(["homebrew/foo/some-formula"])
|
2017-02-21 05:13:05 +01:00
|
|
|
end
|
|
|
|
end
|