Skip to content
Snippets Groups Projects
Commit 281632b6 authored by Bo Anderson's avatar Bo Anderson
Browse files

test: ensure `require "formula"` isn't run on startup

parent e3372e2a
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
describe "brew", :integration_test do
it "does not invoke `require \"formula\"` at startup" do
expect { brew "verify-formula-undefined" }
.to not_to_output.to_stdout
.and not_to_output.to_stderr
.and be_a_success
end
end
# frozen_string_literal: true
require "cli/parser"
parser = Homebrew::CLI::Parser.new do
usage_banner <<~EOS
`verify-formula-undefined`
Verifies that `require "formula"` has not been performed at startup.
EOS
end
parser.parse
Homebrew.failed = defined?(Formula) && Formula.respond_to?(:[])
......@@ -66,8 +66,10 @@ RSpec.shared_context "integration test" do
env = args.last.is_a?(Hash) ? args.pop : {}
# Avoid warnings when HOMEBREW_PREFIX/bin is not in PATH.
# Also include our extra commands directory.
path = [
env["PATH"],
(HOMEBREW_LIBRARY_PATH/"test/support/helper/cmd").realpath.to_s,
(HOMEBREW_PREFIX/"bin").realpath.to_s,
ENV["PATH"],
].compact.join(File::PATH_SEPARATOR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment