Test that EnvConfig::ENVS hash keys are alphabetical

- Spoiler: they aren't.
- As part of Volunteer Month at work I introduced `hharen` to contributing to
  Homebrew, `cd $(brew --repo)`, `brew tests`, `brew style`, etc.
- We started to write a RuboCop for this. But my current thinking is that this
  test might be sufficient since it might be easier to notice "oop, a test is
  failing and I've added a new envvar" and re-alphabetize it than to write a
  RuboCop linter for it to do the one-time autofix. Considering how little this
  gets changed?

Co-authored-by: Hana <hharen@github.com>
This commit is contained in:
Issy Long 2024-04-11 16:45:31 +01:00
parent 2f58aaa285
commit c72598d937
No known key found for this signature in database

View File

@ -5,6 +5,12 @@ require "diagnostic"
RSpec.describe Homebrew::EnvConfig do
subject(:env_config) { described_class }
describe "ENVS" do
it "sorts alphabetically" do
expect(env_config::ENVS.keys).to eql(env_config::ENVS.keys.sort)
end
end
describe ".env_method_name" do
it "generates method names" do
expect(env_config.env_method_name("HOMEBREW_FOO", {})).to eql("foo")