summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_build_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_build_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 703512ecba..08854f0bf1 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -1,3 +1,4 @@
+
# frozen_string_literal: true
require 'rubygems/test_case'
require 'rubygems/commands/build_command'
@@ -117,5 +118,30 @@ class TestGemCommandsBuildCommand < Gem::TestCase
util_test_build_gem @gem, gemspec_file, false
end
-end
+ CERT_FILE = cert_path 'public3072'
+ SIGNING_KEY = key_path 'private3072'
+
+ def test_build_signed_gem
+ trust_dir = Gem::Security.trust_dir
+
+ spec = util_spec 'some_gem' do |s|
+ s.signing_key = SIGNING_KEY
+ s.cert_chain = [CERT_FILE]
+ end
+
+ gemspec_file = File.join(@tempdir, spec.spec_name)
+
+ File.open gemspec_file, 'w' do |gs|
+ gs.write spec.to_ruby
+ end
+
+ util_test_build_gem spec, gemspec_file
+
+ trust_dir.trust_cert OpenSSL::X509::Certificate.new(File.read(CERT_FILE))
+ gem = Gem::Package.new(File.join(@tempdir, spec.file_name),
+ Gem::Security::HighSecurity)
+ assert gem.verify
+ end
+
+end