diff options
Diffstat (limited to 'test/rubygems/gemutilities.rb')
-rw-r--r-- | test/rubygems/gemutilities.rb | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/test/rubygems/gemutilities.rb b/test/rubygems/gemutilities.rb index 0ab2c5272c..d1e50676d5 100644 --- a/test/rubygems/gemutilities.rb +++ b/test/rubygems/gemutilities.rb @@ -19,6 +19,10 @@ require 'rubygems/test_utilities' require File.join(File.expand_path(File.dirname(__FILE__)), 'mockgemui') module Gem + def self.searcher=(searcher) + MUTEX.synchronize do @searcher = searcher end + end + def self.source_index=(si) @@source_index = si end @@ -26,7 +30,7 @@ module Gem def self.win_platform=(val) @@win_platform = val end - + module DefaultUserInteraction @ui = MockGemUi.new end @@ -89,6 +93,27 @@ class RubyGemTestCase < Test::Unit::TestCase 'private_key.pem') @public_cert = File.expand_path File.join(File.dirname(__FILE__), 'public_cert.pem') + + Gem.post_install_hooks.clear + Gem.post_uninstall_hooks.clear + Gem.pre_install_hooks.clear + Gem.pre_uninstall_hooks.clear + + Gem.post_install do |installer| + @post_install_hook_arg = installer + end + + Gem.post_uninstall do |uninstaller| + @post_uninstall_hook_arg = uninstaller + end + + Gem.pre_install do |installer| + @pre_install_hook_arg = installer + end + + Gem.pre_uninstall do |uninstaller| + @pre_uninstall_hook_arg = uninstaller + end end def teardown @@ -435,7 +460,15 @@ class RubyGemTestCase < Test::Unit::TestCase end @@ruby = rubybin - @@rake = ENV["rake"] || (@@ruby + " " + File.expand_path("../../../bin/rake", __FILE__)) + env_rake = ENV['rake'] + ruby19_rake = @@ruby + " " + File.expand_path("../../../bin/rake", __FILE__) + @@rake = if env_rake then + ENV["rake"] + elsif File.exist? ruby19_rake then + ruby19_rake + else + 'rake' + end end |