aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd/search_remote_tap_spec.rb
blob: eb256b9245ada8bb07c51f497633312cf647a2bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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