brew/Library/Homebrew/test/cmd/search_remote_tap_spec.rb
Misty De Meo a26cde8299
search_remote_tap spec: fix test offline
Even though we stub the JSON response, the method being tested always
returns [] immediately if HOMEBREW_NO_GITHUB_API is set.
2017-08-31 22:29:43 -07:00

25 lines
575 B
Ruby

require "cmd/search"
describe Homebrew do
specify "#search_taps" do
# Otherwise the tested method returns [], regardless of our stub
ENV.delete("HOMEBREW_NO_GITHUB_API")
json_response = {
"items" => [
{
"path" => "Formula/some-formula.rb",
"repository" => {
"full_name" => "Homebrew/homebrew-foo",
},
},
],
}
allow(GitHub).to receive(:open).and_yield(json_response)
expect(described_class.search_taps("some-formula"))
.to match(["homebrew/foo/some-formula"])
end
end