summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--install.rb10
-rwxr-xr-xtests/tc_facterbin.rb16
-rw-r--r--tests/tc_simple.rb11
3 files changed, 21 insertions, 16 deletions
diff --git a/install.rb b/install.rb
index 7780ed3..6dfa33e 100644
--- a/install.rb
+++ b/install.rb
@@ -197,10 +197,15 @@ end
def run_tests(test_list)
begin
require 'test/unit/ui/console/testrunner'
+ require 'test/unit'
+
+ unless defined? Test::Unit::TestCase
+ raise LoadError, "Could not find unit test library"
+ end
$:.unshift "lib"
test_list.each do |test|
- next if File.directory?(test)
- require test
+ next if File.directory?(test)
+ require test
end
tests = []
@@ -293,6 +298,5 @@ bd = nil
# bd = "#{Config::CONFIG['bindir']}"
#end
-puts "bin dir is %s" % InstallOptions.bin_dir
do_bins(bins, InstallOptions.bin_dir)
do_libs(libs)
diff --git a/tests/tc_facterbin.rb b/tests/tc_facterbin.rb
index 07e820b..586954b 100755
--- a/tests/tc_facterbin.rb
+++ b/tests/tc_facterbin.rb
@@ -1,7 +1,8 @@
#! /usr/bin/env ruby
-# $Id: $
-$:.unshift '../lib'
-$facterbase = ".."
+
+$facterbase = File.dirname(File.dirname(__FILE__))
+libdir = File.join($facterbase, "lib")
+$:.unshift libdir
require 'facter'
require 'test/unit'
@@ -9,11 +10,8 @@ require 'test/unit'
# add the bin directory to our search path
ENV["PATH"] = File.join($facterbase, "bin") + ":" + ENV["PATH"]
-# and then the library directories
-libdirs = $:.find_all { |dir|
- dir =~ /facter/ or dir =~ /\.\./
-}
-ENV["RUBYLIB"] = libdirs.join(":")
+# and then the library directory
+ENV["RUBYLIB"] = libdir
class TestFacterBin < Test::Unit::TestCase
def test_version
@@ -24,3 +22,5 @@ class TestFacterBin < Test::Unit::TestCase
assert(output == Facter.version)
end
end
+
+# $Id$
diff --git a/tests/tc_simple.rb b/tests/tc_simple.rb
index 8510fcf..bf5cfc2 100644
--- a/tests/tc_simple.rb
+++ b/tests/tc_simple.rb
@@ -1,9 +1,8 @@
#! /usr/bin/env ruby
-# $Id$
-#
-if __FILE__ == $0 # Make this library first!
- $:.unshift '../lib'
-end
+
+$facterbase = File.dirname(File.dirname(__FILE__))
+libdir = File.join($facterbase, "lib")
+$:.unshift libdir
require 'test/unit'
require 'facter'
@@ -325,3 +324,5 @@ end
"Got incorrect value for autoloaded fact")
end
end
+
+# $Id$