brew/Library/Homebrew/test/cmd/custom-external-command_spec.rb

22 lines
542 B
Ruby
Raw Normal View History

# frozen_string_literal: true
describe "brew custom-external-command", :integration_test do
it "is supported" do
2017-02-28 14:50:46 +01:00
mktmpdir do |path|
cmd = "custom-external-command-#{rand}"
file = path/"brew-#{cmd}"
2018-07-11 15:17:40 +02:00
file.write <<~SH
#!/bin/sh
echo 'I am #{cmd}.'
2018-07-11 15:17:40 +02:00
SH
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