aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2015-04-20 22:33:25 -0400
committerJack Nagel2015-04-20 22:33:25 -0400
commiteafc48e99ab640140a0db5db417f6afc1d9e6f14 (patch)
treec9c1aff9ffba403e719f951358c91255dc009b36
parent5aaf13c6cf784cb4be62932b3e528e8f93580a65 (diff)
downloadhomebrew-eafc48e99ab640140a0db5db417f6afc1d9e6f14.tar.bz2
Revert "Use real repo to run tests"
This reverts commit 5aaf13c6cf784cb4be62932b3e528e8f93580a65.
-rw-r--r--Library/Homebrew/test/test_ENV.rb16
-rw-r--r--Library/Homebrew/test/test_formula.rb14
-rw-r--r--Library/Homebrew/test/testing_env.rb10
3 files changed, 31 insertions, 9 deletions
diff --git a/Library/Homebrew/test/test_ENV.rb b/Library/Homebrew/test/test_ENV.rb
index 94a182ac2..a5ee46e88 100644
--- a/Library/Homebrew/test/test_ENV.rb
+++ b/Library/Homebrew/test/test_ENV.rb
@@ -127,12 +127,24 @@ end
class SuperenvTests < Homebrew::TestCase
include SharedEnvTests
+ attr_reader :env, :bin
+
def setup
@env = {}.extend(Superenv)
+ @bin = HOMEBREW_REPOSITORY/"Library/ENV/#{MacOS::Xcode.version}"
+ bin.mkpath
+ end
+
+ def test_bin
+ assert_equal bin, Superenv.bin
end
def test_initializes_deps
- assert_equal [], @env.deps
- assert_equal [], @env.keg_only_deps
+ assert_equal [], env.deps
+ assert_equal [], env.keg_only_deps
+ end
+
+ def teardown
+ bin.rmtree
end
end
diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb
index d17ab272e..fbac07109 100644
--- a/Library/Homebrew/test/test_formula.rb
+++ b/Library/Homebrew/test/test_formula.rb
@@ -178,7 +178,19 @@ class FormulaTests < Homebrew::TestCase
end
def test_factory
- assert_kind_of Formula, Formulary.factory("tree")
+ name = 'foo-bar'
+ path = HOMEBREW_PREFIX+"Library/Formula/#{name}.rb"
+ path.dirname.mkpath
+ File.open(path, 'w') do |f|
+ f << %{
+ class #{Formulary.class_s(name)} < Formula
+ url 'foo-1.0'
+ end
+ }
+ end
+ assert_kind_of Formula, Formulary.factory(name)
+ ensure
+ path.unlink
end
def test_class_specs_are_always_initialized
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 1e3f917b0..fc5d80441 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -1,7 +1,6 @@
# Require this file to build a testing environment.
-repo_root = Pathname.new File.expand_path("../../../..", __FILE__)
-$: << repo_root.join("Library", "Homebrew").to_s
+$:.push(File.expand_path(__FILE__+'/../..'))
require 'extend/module'
require 'extend/fileutils'
@@ -20,10 +19,8 @@ at_exit { FileUtils.remove_entry(TEST_TMPDIR) }
# Constants normally defined in global.rb
HOMEBREW_PREFIX = Pathname.new(TEST_TMPDIR).join("prefix")
-HOMEBREW_REPOSITORY = repo_root
-HOMEBREW_BREW_FILE = HOMEBREW_REPOSITORY+"bin"+"brew"
+HOMEBREW_REPOSITORY = HOMEBREW_PREFIX
HOMEBREW_LIBRARY = HOMEBREW_REPOSITORY+'Library'
-HOMEBREW_LIBRARY_PATH = HOMEBREW_LIBRARY+"Homebrew"
HOMEBREW_CACHE = HOMEBREW_PREFIX.parent+'cache'
HOMEBREW_CACHE_FORMULA = HOMEBREW_PREFIX.parent+'formula_cache'
HOMEBREW_CELLAR = HOMEBREW_PREFIX.parent+'cellar'
@@ -51,7 +48,8 @@ MACOS_VERSION = ENV.fetch('MACOS_VERSION') { MACOS_FULL_VERSION[/10\.\d+/] }
ORIGINAL_PATHS = ENV['PATH'].split(File::PATH_SEPARATOR).map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
# Test environment setup
-%w{prefix cache formula_cache cellar logs}.each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
+%w{ENV Formula}.each { |d| HOMEBREW_LIBRARY.join(d).mkpath }
+%w{cache formula_cache cellar logs}.each { |d| HOMEBREW_PREFIX.parent.join(d).mkpath }
# Test fixtures and files can be found relative to this path
TEST_DIRECTORY = File.dirname(File.expand_path(__FILE__))