Define the test_defined? method dynamically
This commit is contained in:
parent
c0ef3d1541
commit
281646b089
@ -490,7 +490,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_defined?
|
def test_defined?
|
||||||
not self.class.instance_variable_get(:@test_defined).nil?
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
@ -592,7 +592,7 @@ class Formula
|
|||||||
when :brew
|
when :brew
|
||||||
raise "You cannot override Formula#brew in class #{name}"
|
raise "You cannot override Formula#brew in class #{name}"
|
||||||
when :test
|
when :test
|
||||||
@test_defined = true
|
define_method(:test_defined?) { true }
|
||||||
when :options
|
when :options
|
||||||
instance = allocate
|
instance = allocate
|
||||||
|
|
||||||
@ -757,7 +757,7 @@ class Formula
|
|||||||
|
|
||||||
def test &block
|
def test &block
|
||||||
return @test unless block_given?
|
return @test unless block_given?
|
||||||
@test_defined = true
|
define_method(:test_defined?) { true }
|
||||||
@test = block
|
@test = block
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user