diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index e1846424f5822..c80cd517f9d22 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1505,7 +1505,7 @@ def recursive_requirements(&block) # Returns a list of Dependency objects that are required at runtime. # @private def runtime_dependencies - recursive_dependencies { |_, dep| Dependency.prune if dep.build? } + recursive_dependencies.reject(&:build?) end # Returns a list of formulae depended on by this formula that aren't diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb index 28d376b7c268e..a6db1b57f2666 100644 --- a/Library/Homebrew/test/formula_test.rb +++ b/Library/Homebrew/test/formula_test.rb @@ -651,19 +651,12 @@ def test_dependencies f4 = formula("f4") do url "f4-1.0" - depends_on "f1" + depends_on "f3" end - stub_formula_loader f4 - f5 = formula("f5") do - url "f5-1.0" - depends_on "f3" => :build - depends_on "f4" - end - - assert_equal %w[f3 f4], f5.deps.map(&:name) - assert_equal %w[f1 f2 f3 f4], f5.recursive_dependencies.map(&:name) - assert_equal %w[f1 f4], f5.runtime_dependencies.map(&:name) + assert_equal %w[f3], f4.deps.map(&:name) + assert_equal %w[f1 f2 f3], f4.recursive_dependencies.map(&:name) + assert_equal %w[f2 f3], f4.runtime_dependencies.map(&:name) end def test_to_hash