aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd/help_spec.rb
blob: 6d94d7444cbf41eb98f61f5dbc589aa81e8088c2 (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
describe "brew", :integration_test do
  it "prints help when no argument is given" do
    expect { brew }
      .to output(/Example usage:\n/).to_stderr
      .and be_a_failure
  end

  describe "help" do
    it "prints help" do
      expect { brew "help" }
        .to output(/Example usage:\n/).to_stdout
        .and be_a_success
    end

    it "prints help for a documented Ruby command" do
      expect { brew "help", "cat" }
        .to output(/^brew cat/).to_stdout
        .and be_a_success
    end

    it "prints help for a documented shell command" do
      expect { brew "help", "update" }
        .to output(/^brew update/).to_stdout
        .and be_a_success
    end

    it "prints help for a documented Ruby developer command" do
      expect { brew "help", "update-test" }
        .to output(/^brew update-test/).to_stdout
        .and be_a_success
    end

    it "fails when given an unknown command" do
      expect { brew "help", "command-that-does-not-exist" }
        .to output(/Unknown command: command-that-does-not-exist/).to_stderr
        .and be_a_failure
    end
  end

  describe "cat" do
    it "prints help when no argument is given" do
      expect { brew "cat" }
        .to output(/^brew cat/).to_stderr
        .and be_a_failure
    end
  end
end