brew/Library/Homebrew/test/rubocop_spec.rb
Douglas Eichelberger 9075cbae62 brew style --fix
2023-04-21 09:58:50 -07:00

23 lines
678 B
Ruby

# frozen_string_literal: true
require "open3"
describe "RuboCop" do
context "when calling `rubocop` outside of the Homebrew environment" do
before do
ENV.each_key do |key|
ENV.delete(key) if key.start_with?("HOMEBREW_") && key != "HOMEBREW_USE_RUBY_FROM_PATH"
end
ENV["XDG_CACHE_HOME"] = (HOMEBREW_CACHE.realpath/"style").to_s
end
it "loads all Formula cops without errors" do
stdout, stderr, status = Open3.capture3(RUBY_PATH, "-W0", "-S", "rubocop", TEST_FIXTURE_DIR/"testball.rb")
expect(stderr).to be_empty
expect(stdout).to include("no offenses detected")
expect(status).to be_a_success
end
end
end