From 63aace0e4e5f6ca0b363e4c5bfd1ae7512a8d091 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Mon, 8 Apr 2013 19:15:22 -0500 Subject: Clean up mirror support test --- Library/Homebrew/test/test_formula.rb | 21 ++++++++++----------- Library/Homebrew/test/testball.rb | 9 --------- 2 files changed, 10 insertions(+), 20 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 3bcf91f10..918ff714f 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -1,10 +1,6 @@ require 'testing_env' require 'test/testball' -class AbstractDownloadStrategy - attr_reader :url -end - class MostlyAbstractFormula < Formula url '' end @@ -40,13 +36,16 @@ class FormulaTests < Test::Unit::TestCase end def test_mirror_support - HOMEBREW_CACHE.mkpath unless HOMEBREW_CACHE.exist? - shutup do - f = TestBallWithMirror.new - _, downloader = f.fetch - assert_equal f.url, "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz" - assert_equal downloader.url, "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz" - end + f = Class.new(Formula) do + url "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz" + mirror "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz" + end.new("test_mirror_support") + + shutup { f.fetch } + + assert_equal "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz", f.url + assert_equal "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz", + f.downloader.instance_variable_get(:@url) end def test_formula_specs diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index 13f54f3df..b18fe3e68 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -16,15 +16,6 @@ class TestBall < Formula end end -class TestBallWithMirror < Formula - url "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz" - mirror "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz" - - def initialize(*) - super "testballwithmirror" - end -end - class ConfigureFails < Formula url "file:///#{TEST_FOLDER}/tarballs/configure_fails.tar.gz" version '1.0.0' -- cgit v1.2.3