test_formula: add test_facotry_with_fully_qualified_name

Closes Homebrew/homebrew#42550.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-08-06 21:25:42 +08:00
parent 68a5b1fe46
commit 4e5227fd4e

View File

@ -228,6 +228,22 @@ class FormulaTests < Homebrew::TestCase
path.unlink path.unlink
end end
def test_factory_with_fully_qualified_name
name = "foo-bar"
path = HOMEBREW_PREFIX+"Library/Formula/#{name}.rb"
path.dirname.mkpath
File.open(path, "w") do |f|
f << %(
class #{Formulary.class_s(name)} < Formula
url 'foo-1.0'
end
)
end
assert_kind_of Formula, Formulary.factory("homebrew/homebrew/#{name}")
ensure
path.unlink
end
def test_class_specs_are_always_initialized def test_class_specs_are_always_initialized
f = formula { url "foo-1.0" } f = formula { url "foo-1.0" }