Skip to content

Commit

Permalink
Add test for Tap#custom_remote?.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Mar 4, 2024
1 parent abc591e commit e369689
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Library/Homebrew/test/tap_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,37 @@ def setup_completion(link:)
end
end

describe "#custom_remote?" do
subject(:tap) { described_class.new("Homebrew", "services") }

let(:remote) { nil }

before do
tap.path.mkpath
system "git", "-C", tap.path, "init"
system "git", "-C", tap.path, "remote", "add", "origin", remote if remote
end

context "if no remote is available" do
it "returns true" do
expect(tap.remote).to be_nil
expect(tap.custom_remote?).to be true
end
end

context "when using the default remote" do
let(:remote) { "https://github.com/Homebrew/homebrew-services" }

its(:custom_remote?) { is_expected.to be false }
end

context "when using a non-default remote" do
let(:remote) { "[email protected]:Homebrew/homebrew-services" }

its(:custom_remote?) { is_expected.to be true }
end
end

specify "Git variant" do
touch path/"README"
setup_git_repo
Expand Down

0 comments on commit e369689

Please sign in to comment.