aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/dev-cmd/tap_spec.rb
blob: d09d0245f3f3a10d52be84c5e2d7bcb99520dfd7 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
describe "brew tap", :integration_test do
  it "taps a given Tap" do
    path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
    path.mkpath
    path.cd do
      system "git", "init"
      system "git", "remote", "add", "origin", "https://github.com/Homebrew/homebrew-foo"
      FileUtils.touch "readme"
      system "git", "add", "--all"
      system "git", "commit", "-m", "init"
    end

    expect { brew "tap" }
      .to output(%r{homebrew/foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap", "--list-official" }
      .to output(%r{homebrew/php}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap-info" }
      .to output(/2 taps/).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap-info", "homebrew/foo" }
      .to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap-info", "--json=v1", "--installed" }
      .to output(%r{https://github\.com/Homebrew/homebrew-foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap-pin", "homebrew/foo" }
      .to output(%r{Pinned homebrew/foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap", "--list-pinned" }
      .to output(%r{homebrew/foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap-unpin", "homebrew/foo" }
      .to output(%r{Unpinned homebrew/foo}).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap", "homebrew/bar", path/".git" }
      .to output(/Tapped/).to_stdout
      .and output(/Cloning/).to_stderr
      .and be_a_success

    expect { brew "untap", "homebrew/bar" }
      .to output(/Untapped/).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success

    expect { brew "tap", "homebrew/bar", path/".git", "-q", "--full" }
      .to be_a_success
      .and not_to_output.to_stdout
      .and not_to_output.to_stderr

    expect { brew "untap", "homebrew/bar" }
      .to output(/Untapped/).to_stdout
      .and not_to_output.to_stderr
      .and be_a_success
  end
end