aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2015-04-28 22:37:27 -0400
committerJack Nagel2015-04-29 19:15:11 -0400
commitc10f19c8385be8d6fa6372926d208230c5f52a0a (patch)
tree48cd59eb32a845b9f9298cf6cfdacc0646b1751d /Library/Homebrew/test
parent2ca8172fe9f1aba5188fc4ab164b34d5def607c9 (diff)
downloadbrew-c10f19c8385be8d6fa6372926d208230c5f52a0a.tar.bz2
Installation tests now use the actual installer
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_formula_install.rb63
-rw-r--r--Library/Homebrew/test/test_formula_installer.rb70
-rw-r--r--Library/Homebrew/test/testball.rb2
3 files changed, 71 insertions, 64 deletions
diff --git a/Library/Homebrew/test/test_formula_install.rb b/Library/Homebrew/test/test_formula_install.rb
deleted file mode 100644
index 1e6200db3..000000000
--- a/Library/Homebrew/test/test_formula_install.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-require 'testing_env'
-require 'formula'
-require 'compat/formula_specialties'
-require 'testball'
-require 'keg'
-
-
-class InstallTests < Homebrew::TestCase
- def temporary_install f
- f.prefix.mkpath
- keg = Keg.new(f.prefix)
-
- shutup do
- f.brew { f.install }
- end
-
- begin
- yield
- ensure
- keg.unlink
- keg.uninstall
- f.clear_cache
- end
-
- refute_predicate keg, :exist?
- refute_predicate f, :installed?
- end
-
- def test_a_basic_install
- f = Testball.new
-
- refute_predicate f, :installed?
-
- temporary_install f do
- # Test that things made it into the Keg
- assert_predicate f.bin, :directory?
- assert_equal 3, f.bin.children.length
-
- assert_predicate f.libexec, :directory?
- assert_equal 1, f.libexec.children.length
-
- refute_predicate f.prefix+'main.c', :exist?
- assert_predicate f, :installed?
-
- # Test that things make it into the Cellar
- keg = Keg.new f.prefix
- keg.link
-
- bin = HOMEBREW_PREFIX+"bin"
- assert_predicate bin, :directory?
- assert_equal 3, bin.children.length
- end
- end
-
- def test_script_install
- f = Class.new(ScriptFileFormula) do
- url "file://#{File.expand_path(__FILE__)}"
- version "1"
- end.new("test_script_formula", Pathname.new(__FILE__).expand_path, :stable)
-
- temporary_install(f) { assert_equal 1, f.bin.children.length }
- end
-end
diff --git a/Library/Homebrew/test/test_formula_installer.rb b/Library/Homebrew/test/test_formula_installer.rb
new file mode 100644
index 000000000..f9ac3fa17
--- /dev/null
+++ b/Library/Homebrew/test/test_formula_installer.rb
@@ -0,0 +1,70 @@
+require "testing_env"
+require "formula"
+require "compat/formula_specialties"
+require "formula_installer"
+require "keg"
+require "testball"
+
+class InstallTests < Homebrew::TestCase
+ def temporary_install(formula)
+ refute_predicate formula, :installed?
+
+ installer = FormulaInstaller.new(formula)
+
+ shutup { installer.install }
+
+ keg = Keg.new(formula.prefix)
+
+ assert_predicate formula, :installed?
+
+ begin
+ yield formula
+ ensure
+ keg.unlink
+ keg.uninstall
+ formula.clear_cache
+ end
+
+ refute_predicate keg, :exist?
+ refute_predicate formula, :installed?
+ end
+
+ def test_a_basic_install
+ temporary_install(Testball.new) do |f|
+ # Test that things made it into the Keg
+ assert_predicate f.bin, :directory?
+ assert_equal 3, f.bin.children.length
+
+ assert_predicate f.libexec, :directory?
+ assert_equal 1, f.libexec.children.length
+
+ refute_predicate f.prefix+'main.c', :exist?
+
+ # Test that things make it into the Cellar
+ keg = Keg.new f.prefix
+ keg.link
+
+ bin = HOMEBREW_PREFIX+"bin"
+ assert_predicate bin, :directory?
+ assert_equal 3, bin.children.length
+ end
+ end
+
+ def test_script_install
+ mktmpdir do |dir|
+ name = "test_script_formula"
+ path = Pathname.new(dir)+"#{name}.rb"
+
+ path.write <<-EOS.undent
+ class #{Formulary.class_s(name)} < ScriptFileFormula
+ url "file://#{File.expand_path(__FILE__)}"
+ version "1"
+ end
+ EOS
+
+ f = Formulary.factory(path.to_s)
+
+ temporary_install(f) { assert_equal 1, f.bin.children.length }
+ end
+ end
+end
diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb
index 78a18e495..0034a7f98 100644
--- a/Library/Homebrew/test/testball.rb
+++ b/Library/Homebrew/test/testball.rb
@@ -1,7 +1,7 @@
class Testball < Formula
def initialize(name="testball", path=Pathname.new(__FILE__).expand_path, spec=:stable)
self.class.instance_eval do
- stable.url "file://#{TEST_DIRECTORY}/tarballs/testball-0.1.tbz"
+ stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz"
stable.sha1 "482e737739d946b7c8cbaf127d9ee9c148b999f5"
end
super