aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/cmd/custom-external-command_spec.rb
blob: 8ccc21fa791c0cd0bc67071c613570feddeb951a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
describe "brew custom-external-command", :integration_test do
  it "is supported" do
    Dir.mktmpdir do |path|
      path = Pathname.new(path)

      cmd = "custom-external-command-#{rand}"
      file = path/"brew-#{cmd}"

      file.write <<-EOS.undent
        #!/bin/sh
        echo 'I am #{cmd}.'
      EOS
      FileUtils.chmod "+x", file

      expect { brew cmd, "PATH" => "#{path}#{File::PATH_SEPARATOR}#{ENV["PATH"]}" }
        .to output("I am #{cmd}.\n").to_stdout
        .and not_to_output.to_stderr
        .and be_a_success
    end
  end
end