mirror of
https://github.com/Homebrew/brew.git
synced 2026-08-12 22:29:27 +04:00
- 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.
23 lines
794 B
Ruby
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
|