diff options
-rw-r--r-- | lib/rubygems/test_case.rb | 155 |
1 files changed, 112 insertions, 43 deletions
@@ -78,6 +78,23 @@ end class Gem::TestCase < MiniTest::Unit::TestCase # TODO: move to minitest def assert_path_exists path, msg = nil msg = message(msg) { "Expected path '#{path}' to exist" } @@ -200,6 +217,7 @@ class Gem::TestCase < MiniTest::Unit::TestCase @gemhome = File.join @tempdir, 'gemhome' @userhome = File.join @tempdir, 'userhome' @orig_ruby = if ENV['RUBY'] then ruby = Gem.instance_variable_get :@ruby @@ -221,6 +239,9 @@ class Gem::TestCase < MiniTest::Unit::TestCase FileUtils.mkdir_p @gemhome FileUtils.mkdir_p @userhome @default_dir = File.join @tempdir, 'default' @default_spec_dir = File.join @default_dir, "specifications", "default" Gem.instance_variable_set :@default_dir, @default_dir @@ -266,39 +287,6 @@ class Gem::TestCase < MiniTest::Unit::TestCase end @marshal_version = "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" - - # TODO: move to installer test cases - Gem.post_build_hooks.clear - Gem.post_install_hooks.clear - Gem.done_installing_hooks.clear - Gem.post_reset_hooks.clear - Gem.post_uninstall_hooks.clear - Gem.pre_install_hooks.clear - Gem.pre_reset_hooks.clear - Gem.pre_uninstall_hooks.clear - - # TODO: move to installer test cases - Gem.post_build do |installer| - @post_build_hook_arg = installer - true - end - - 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 - true - end - - Gem.pre_uninstall do |uninstaller| - @pre_uninstall_hook_arg = uninstaller - end end ## @@ -332,6 +320,47 @@ class Gem::TestCase < MiniTest::Unit::TestCase end Gem.instance_variable_set :@default_dir, nil end ## @@ -560,6 +589,21 @@ class Gem::TestCase < MiniTest::Unit::TestCase end end ## # Create a new spec (or gem if passed an array of files) and set it # up properly. Use this instead of util_spec and util_gem. @@ -1006,6 +1050,24 @@ Also, a list: end ## # Constructs a new Gem::Requirement. def req *requirements @@ -1074,18 +1136,18 @@ Also, a list: end ## - # Loads an RSA private key named +key_name+ in <tt>test/rubygems/</tt> - def self.load_key key_name key_file = key_path key_name key = File.read key_file - OpenSSL::PKey::RSA.new key end ## - # Returns the path tot he key named +key_name+ from <tt>test/rubygems</tt> def self.key_path key_name File.expand_path "../../../test/rubygems/#{key_name}_key.pem", __FILE__ @@ -1094,17 +1156,24 @@ Also, a list: # :stopdoc: # only available in RubyGems tests begin - PRIVATE_KEY = load_key 'private' - PRIVATE_KEY_PATH = key_path 'private' - PUBLIC_KEY = PRIVATE_KEY.public_key - PUBLIC_CERT = load_cert 'public' - PUBLIC_CERT_PATH = cert_path 'public' rescue Errno::ENOENT PRIVATE_KEY = nil PUBLIC_KEY = nil PUBLIC_CERT = nil - end end |