From a7a2093eee8500845415416d7f4cc21614d3c707 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Wed, 5 Jan 2011 02:26:20 -0800 Subject: + Added Hoe::Test#test_prelude to allow for code to run before test loading. + Added support for rubygems-test. See http://www.gem-testers.org/ [git-p4: depot-paths = "//src/hoe/dev/": change = 6105] --- lib/hoe/test.rb | 25 +++++++++++++++++++++++++ test/test_hoe.rb | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lib/hoe/test.rb b/lib/hoe/test.rb index c294b3b..ffe70bb 100644 --- a/lib/hoe/test.rb +++ b/lib/hoe/test.rb @@ -36,6 +36,11 @@ module Hoe::Test attr_accessor :testlib + ## + # Optional: Additional ruby to run before the test framework is loaded. + + attr_accessor :test_prelude + ## # Optional: RSpec dirs. [default: %w(spec lib)] @@ -52,6 +57,7 @@ module Hoe::Test def initialize_test self.multiruby_skip ||= [] self.testlib ||= :testunit + self.test_prelude ||= nil self.rspec_dirs ||= %w(spec lib) self.rspec_options ||= [] end @@ -125,6 +131,23 @@ module Hoe::Test desc 'Run the default task(s).' task :default => default_tasks + unless default_tasks.empty? then + ## + # This is for Erik Hollensbe's rubygems-test project. Hoe is + # test-happy, so by using this plugin you're already testable. For + # more information, see: + # and/or + + self.spec.files += [".gemtest"] + + pkg = pkg_path + turd = "#{pkg}/.gemtest" + + task pkg do + touch turd + end + end + desc 'Run ZenTest against the package.' task :audit do libs = %w(lib test ext).join(File::PATH_SEPARATOR) @@ -143,6 +166,8 @@ module Hoe::Test test_globs.map { |g| Dir.glob(g) }.flatten tests.map! {|f| %(require "#{f}")} + tests.insert 1, test_prelude if test_prelude + cmd = "#{Hoe::RUBY_FLAGS} -e '#{tests.join("; ")}' -- #{FILTER}" if multi then diff --git a/test/test_hoe.rb b/test/test_hoe.rb index 154981e..36422a8 100644 --- a/test/test_hoe.rb +++ b/test/test_hoe.rb @@ -24,7 +24,7 @@ class TestHoe < MiniTest::Unit::TestCase developer 'author', 'email' end - files = File.read("Manifest.txt").split(/\n/) + files = File.read("Manifest.txt").split(/\n/) + [".gemtest"] spec = hoe.spec -- cgit v1.2.1