Fix specs in TestBall
This commit is contained in:
parent
a90259b690
commit
d07defa7c1
@ -61,7 +61,12 @@ class BeerTasting < Test::Unit::TestCase
|
||||
|
||||
shutup do
|
||||
assert_nothing_raised do
|
||||
f=TestBallWithRealPath.new
|
||||
f = Class.new(TestBall) do
|
||||
def initialize(*)
|
||||
super
|
||||
@path = Pathname.new(__FILE__)
|
||||
end
|
||||
end.new
|
||||
Homebrew.info_formula f
|
||||
Homebrew.prune
|
||||
#TODO test diy function too
|
||||
@ -72,15 +77,9 @@ class BeerTasting < Test::Unit::TestCase
|
||||
def test_brew_cleanup
|
||||
require 'cmd/cleanup'
|
||||
|
||||
f1 = TestBall.new
|
||||
f1.instance_eval { @version = Version.new("0.1") }
|
||||
f1.active_spec.instance_eval { @version = Version.new("0.1") }
|
||||
f2 = TestBall.new
|
||||
f2.instance_eval { @version = Version.new("0.2") }
|
||||
f2.active_spec.instance_eval { @version = Version.new("0.2") }
|
||||
f3 = TestBall.new
|
||||
f3.instance_eval { @version = Version.new("0.3") }
|
||||
f3.active_spec.instance_eval { @version = Version.new("0.3") }
|
||||
f1 = Class.new(TestBall) { version '0.1' }.new
|
||||
f2 = Class.new(TestBall) { version '0.2' }.new
|
||||
f3 = Class.new(TestBall) { version '0.3' }.new
|
||||
|
||||
shutup do
|
||||
f1.brew { f1.install }
|
||||
|
||||
@ -13,12 +13,9 @@ class FormulaTests < Test::Unit::TestCase
|
||||
include VersionAssertions
|
||||
|
||||
def test_prefix
|
||||
shutup do
|
||||
TestBall.new.brew do |f|
|
||||
assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s
|
||||
assert_kind_of Pathname, f.prefix
|
||||
end
|
||||
end
|
||||
f = TestBall.new
|
||||
assert_equal File.expand_path(f.prefix), (HOMEBREW_CELLAR+f.name+'0.1').to_s
|
||||
assert_kind_of Pathname, f.prefix
|
||||
end
|
||||
|
||||
def test_class_naming
|
||||
@ -234,9 +231,10 @@ class FormulaTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_custom_version_scheme
|
||||
f = CustomVersionSchemeTestBall.new
|
||||
scheme = Class.new(Version)
|
||||
f = Class.new(TestBall) { version '1.0' => scheme }.new
|
||||
|
||||
assert_version_equal '1.0', f.version
|
||||
assert_instance_of CustomVersionScheme, f.version
|
||||
assert_instance_of scheme, f.version
|
||||
end
|
||||
end
|
||||
|
||||
@ -3,14 +3,6 @@ require 'formula'
|
||||
require 'test/testball'
|
||||
require 'version'
|
||||
|
||||
class TestBadVersion < TestBall
|
||||
def initialize name=nil
|
||||
@stable = SoftwareSpec.new
|
||||
@stable.version "versions can't have spaces"
|
||||
super 'testbadversion'
|
||||
end
|
||||
end
|
||||
|
||||
class VersionComparisonTests < Test::Unit::TestCase
|
||||
include VersionAssertions
|
||||
|
||||
@ -59,7 +51,11 @@ class VersionParsingTests < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
def test_bad_version
|
||||
assert_raises(RuntimeError) { TestBadVersion.new }
|
||||
assert_raises(RuntimeError) do
|
||||
Class.new(TestBall) do
|
||||
version "versions can't have spaces"
|
||||
end.new
|
||||
end
|
||||
end
|
||||
|
||||
def test_version_all_dots
|
||||
|
||||
@ -1,10 +1,13 @@
|
||||
require 'formula'
|
||||
|
||||
class TestBall < Formula
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
@homepage = 'http://example.com/'
|
||||
@stable ||= SoftwareSpec.new
|
||||
@stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
|
||||
self.class.instance_eval do
|
||||
@stable ||= SoftwareSpec.new
|
||||
@stable.url "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
|
||||
@stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5"
|
||||
end
|
||||
super "testball"
|
||||
end
|
||||
def install
|
||||
@ -13,18 +16,11 @@ class TestBall < Formula
|
||||
end
|
||||
end
|
||||
|
||||
class TestBallWithRealPath < TestBall
|
||||
def initialize name=nil
|
||||
super "testballwithrealpath"
|
||||
@path = Pathname.new(__FILE__)
|
||||
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 name=nil
|
||||
def initialize(*)
|
||||
super "testballwithmirror"
|
||||
end
|
||||
end
|
||||
@ -34,7 +30,7 @@ class ConfigureFails < Formula
|
||||
version '1.0.0'
|
||||
sha1 'b36c65e5de86efef1b3a7e9cf78a98c186b400b3'
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "configurefails"
|
||||
end
|
||||
|
||||
@ -64,7 +60,7 @@ class SpecTestBall < Formula
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "spectestball"
|
||||
end
|
||||
end
|
||||
@ -88,7 +84,7 @@ class ExplicitVersionSpecTestBall < Formula
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "explicitversionspectestball"
|
||||
end
|
||||
end
|
||||
@ -97,7 +93,7 @@ class HeadOnlySpecTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
head 'https://github.com/mxcl/homebrew.git'
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "headyonlyspectestball"
|
||||
end
|
||||
end
|
||||
@ -107,7 +103,7 @@ class IncompleteStableSpecTestBall < Formula
|
||||
head 'https://github.com/mxcl/homebrew.git'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "incompletestablespectestball"
|
||||
end
|
||||
end
|
||||
@ -117,7 +113,7 @@ class HeadOnlyWithVersionSpecTestBall < Formula
|
||||
head 'https://github.com/mxcl/homebrew.git'
|
||||
version '0.3'
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "headonlywithversionspectestball"
|
||||
end
|
||||
end
|
||||
@ -131,7 +127,7 @@ class ExplicitStrategySpecTestBall < Formula
|
||||
url 'file:///foo.com/testball-devel', :using => :bzr, :tag => '0.3'
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "explicitstrategyspectestball"
|
||||
end
|
||||
end
|
||||
@ -146,7 +142,7 @@ class SnowLeopardBottleSpecTestBall < Formula
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :snow_leopard
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "snowleopardbottlespectestball"
|
||||
end
|
||||
end
|
||||
@ -161,7 +157,7 @@ class LionBottleSpecTestBall < Formula
|
||||
sha1 'deadbeefdeadbeefdeadbeefdeadbeefdeadbeef' => :lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "lionbottlespectestball"
|
||||
end
|
||||
end
|
||||
@ -180,7 +176,7 @@ class AllCatsBottleSpecTestBall < Formula
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "allcatsbottlespectestball"
|
||||
end
|
||||
end
|
||||
@ -198,21 +194,7 @@ class RevisedBottleSpecTestBall < Formula
|
||||
sha1 '8badf00d8badf00d8badf00d8badf00d8badf00d' => :mountain_lion
|
||||
end
|
||||
|
||||
def initialize name=nil
|
||||
def initialize(*)
|
||||
super "revisedbottlespectestball"
|
||||
end
|
||||
end
|
||||
|
||||
class CustomVersionScheme < Version
|
||||
end
|
||||
|
||||
class CustomVersionSchemeTestBall < Formula
|
||||
homepage 'http://example.com'
|
||||
url 'file:///foo.com/testball-0.1.tbz'
|
||||
sha1 '482e737739d946b7c8cbaf127d9ee9c148b999f5'
|
||||
version '1.0' => CustomVersionScheme
|
||||
|
||||
def initialize name=nil
|
||||
super "customversionschemetestball"
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user