Made the tests green for the updater component

This commit is contained in:
Eloy Duran 2009-09-25 21:04:57 +02:00 committed by Max Howell
parent 5a2eae5d49
commit fab877de18

View File

@ -34,18 +34,21 @@ require 'ARGV+yeast' # needs to be after test/unit to avoid conflict with Option
class MockFormula <Formula class MockFormula <Formula
def initialize url def initialize url
@url=url @url=url
@homepage = 'http://example.com/'
super 'test' super 'test'
end end
end end
class MostlyAbstractFormula <Formula class MostlyAbstractFormula <Formula
@url='' @url=''
@homepage = 'http://example.com/'
end end
class TestBall <Formula class TestBall <Formula
# name parameter required for some Formula::factory # name parameter required for some Formula::factory
def initialize name=nil def initialize name=nil
@url="file:///#{Pathname.new(ABS__FILE__).parent.realpath}/testball-0.1.tbz" @url="file:///#{Pathname.new(ABS__FILE__).parent.realpath}/testball-0.1.tbz"
@homepage = 'http://example.com/'
super "testball" super "testball"
end end
def install def install
@ -59,6 +62,7 @@ class TestZip <Formula
zip=HOMEBREW_CACHE.parent+'test-0.1.zip' zip=HOMEBREW_CACHE.parent+'test-0.1.zip'
Kernel.system '/usr/bin/zip', '-0', zip, ABS__FILE__ Kernel.system '/usr/bin/zip', '-0', zip, ABS__FILE__
@url="file://#{zip}" @url="file://#{zip}"
@homepage = 'http://example.com/'
super 'testzip' super 'testzip'
end end
end end
@ -80,8 +84,9 @@ class TestScriptFileFormula <ScriptFileFormula
version "1" version "1"
def initialize def initialize
super
@name='test-script-formula' @name='test-script-formula'
@homepage = 'http://example.com/'
super
end end
end end
@ -357,7 +362,18 @@ class BeerTasting <Test::Unit::TestCase
path=HOMEBREW_PREFIX+'Library'+'Formula'+"#{FOOBAR}.rb" path=HOMEBREW_PREFIX+'Library'+'Formula'+"#{FOOBAR}.rb"
path.dirname.mkpath path.dirname.mkpath
`echo "require 'brewkit'; class #{classname} <Formula; @url=''; end" > #{path}` File.open(path, 'w') do |f|
f << %{
require 'brewkit'
class #{classname} < Formula
@url=''
def initialize(*args)
@homepage = 'http://example.com/'
super
end
end
}
end
assert_not_nil Formula.factory(FOOBAR) assert_not_nil Formula.factory(FOOBAR)
end end