From fab877de187fe2729ea7331b8b453d735972e22b Mon Sep 17 00:00:00 2001
From: Eloy Duran <eloy.de.enige@gmail.com>
Date: Fri, 25 Sep 2009 21:04:57 +0200
Subject: [PATCH] Made the tests green for the updater component

---
 Library/Homebrew/unittest.rb | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb
index 27e9c0d931..082306069e 100755
--- a/Library/Homebrew/unittest.rb
+++ b/Library/Homebrew/unittest.rb
@@ -34,18 +34,21 @@ require 'ARGV+yeast' # needs to be after test/unit to avoid conflict with Option
 class MockFormula <Formula
   def initialize url
     @url=url
+    @homepage = 'http://example.com/'
     super 'test'
   end
 end
 
 class MostlyAbstractFormula <Formula
   @url=''
+  @homepage = 'http://example.com/'
 end
 
 class TestBall <Formula
   # name parameter required for some Formula::factory
   def initialize name=nil
     @url="file:///#{Pathname.new(ABS__FILE__).parent.realpath}/testball-0.1.tbz"
+    @homepage = 'http://example.com/'
     super "testball"
   end
   def install
@@ -59,6 +62,7 @@ class TestZip <Formula
     zip=HOMEBREW_CACHE.parent+'test-0.1.zip'
     Kernel.system '/usr/bin/zip', '-0', zip, ABS__FILE__
     @url="file://#{zip}"
+    @homepage = 'http://example.com/'
     super 'testzip'
   end
 end
@@ -80,8 +84,9 @@ class TestScriptFileFormula <ScriptFileFormula
   version "1"
   
   def initialize
-    super
     @name='test-script-formula'
+    @homepage = 'http://example.com/'
+    super
   end
 end
 
@@ -357,7 +362,18 @@ class BeerTasting <Test::Unit::TestCase
 
     path=HOMEBREW_PREFIX+'Library'+'Formula'+"#{FOOBAR}.rb"
     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)
   end
-- 
GitLab