Files
brew/Library/Homebrew/test/bump_spec.rb
T
Mike McQuaid 204ea7e964 Make tests use public APIs and enable their cops
- Make every statically-poked method public and call it directly,
  keeping `public_send` only for dynamically-named public methods.
- Read and write state through public `attr_*` accessors instead of
  instance variable reflection.
- Enable `Homebrew/NoSendInTests` and
  `Homebrew/NoInstanceVariableAccessInTests` now the test suite is
  clean, so neither pattern creeps back in.
- Keep rare justified disables, e.g. `Module#remove_const` is
  private core Ruby and raw memoisation state has no accessor.
2026-07-27 08:11:46 +01:00

23 lines
794 B
Ruby

# typed: strict
# frozen_string_literal: true
require "bump"
RSpec.describe Homebrew::Bump do
describe "::redacted_url" do
it "masks env-token credentials embedded in a push URL" do
allow(GitHub::API).to receive(:credentials).and_return("ghp_secrettoken")
expect(described_class.redacted_url(
"https://x-access-token:ghp_secrettoken@github.com/Homebrew/homebrew-core",
))
.to eq("https://x-access-token:******@github.com/Homebrew/homebrew-core")
end
it "leaves a credential-free URL unchanged" do
allow(GitHub::API).to receive(:credentials).and_return(nil)
expect(described_class.redacted_url("https://github.com/Homebrew/homebrew-core"))
.to eq("https://github.com/Homebrew/homebrew-core")
end
end
end