From 2912ebfbfe518d5485ed2cc9239677d7ad629c6b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 25 Jul 2018 09:37:33 +0200 Subject: [PATCH] Add test for `Tap::from_path`. --- Library/Homebrew/test/tap_spec.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Library/Homebrew/test/tap_spec.rb b/Library/Homebrew/test/tap_spec.rb index 1bcfa4d33f..635008a2f4 100644 --- a/Library/Homebrew/test/tap_spec.rb +++ b/Library/Homebrew/test/tap_spec.rb @@ -82,6 +82,20 @@ describe Tap do end end + describe "::from_path" do + let(:tap) { described_class.fetch("Homebrew", "core") } + let(:path) { tap.path } + let(:formula_path) { path/"Formula/formula.rb" } + + it "returns the Tap for a Formula path" do + expect(described_class.from_path(formula_path)).to eq tap + end + + it "returns the Tap when given its exact path" do + expect(described_class.from_path(path)).to eq tap + end + end + specify "::names" do expect(described_class.names.sort).to eq(["homebrew/core", "homebrew/foo"]) end