You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: test_gem_security_signer.rb
    path of file: ./repos/ruby/test/rubygems
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative "helper"

unless Gem::HAVE_OPENSSL
  warn "Skipping Gem::Security::Signer tests.  openssl not found."
end

class TestGemSecuritySigner < Gem::TestCase
  ALTERNATE_KEY  = load_key "alternate"
  CHILD_KEY      = load
    
  def test_sign_expired_auto_update_exists
    FileUtils.mkdir_p File.join(Gem.user_home, ".gem"), mode: 0o700

    expiry = EXPIRED_CERT.not_after.strftime "%Y%m%d%H%M%S"
    expired_path =
      File.join Gem.user_home, "gem-public_cert.pem.expired.#{expiry}"

    Gem::Security.write EXPIRED_CERT, expired_path

    private_key_path = File.join(Gem.user_home, "gem-private_key.pem")
    Gem::Security.write PRIVATE_KEY, private_key_path

    cert_path = File.join Gem.user_home, "gem-public_cert.pem"
    Gem::Security.write EXPIRED_CERT, cert_path

    signer = Gem::Security::Signer.new PRIVATE_KEY, [EXPIRED_CERT]

    e = assert_raise Gem::Security::Exception do
      signer.sign "hello"
    end

    assert_match %r{certificate /CN=nobody/DC=example not valid}, e.message
  end