Use mock of Gem::Security::OPT[:trust_dir]

Gem::Security::OPT[:trust_dir] depends Gem.user_home but doesn't reset
on setup/teardown.
NOTE: Gem.user_home won't be recovered now, so teardown doesn't work.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-04-18 23:14:26 +00:00
Родитель 7cfc4be298
Коммит 61c1fb7058
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -4,6 +4,16 @@ require 'rubygems/fix_openssl_warnings' if RUBY_VERSION < "1.9"
class TestGemSecurity < Gem::TestCase
def setup
super
Gem::Security::OPT[:trust_dir] = File.join(Gem.user_home, '.gem', 'trust')
end
def teardown
super
Gem::Security::OPT[:trust_dir] = File.join(Gem.user_home, '.gem', 'trust')
end
def test_class_build_cert
name = OpenSSL::X509::Name.parse "CN=nobody/DC=example"
key = OpenSSL::PKey::RSA.new 512