Sha256: 2a16051324feeb19da7ffb600fd18c388027b208e0f0e0758ae31ffb0889b50a

Contents?: true

Size: 957 Bytes

Versions: 6

Compression:

Stored size: 957 Bytes

Contents

require 'spec_helper'

describe Keychain::Certificate do
  # Test using the com.apple.systemdefault self-signed certificate that
  # all OSX machines should have installed.
  let(:query){{:label => 'com.apple.systemdefault'}}

  describe 'query' do
    it 'should return a certificate' do
      scope = Keychain::Scope.new(Sec::Classes::CERTIFICATE)
      certs = scope.where(query).all
      expect(certs.length).to be > 0
      expect(certs.first).to be_kind_of(Keychain::Certificate)
    end
  end

  describe 'certificate' do
    it 'should have a public key' do
      scope = Keychain::Scope.new(Sec::Classes::CERTIFICATE)
      cert = scope.where(query).first
      expect(cert.public_key).to be_kind_of(Keychain::Key)
    end

    it 'should be exportable to x509' do
      scope = Keychain::Scope.new(Sec::Classes::CERTIFICATE)
      cert = scope.where(query).first
      expect(cert.x509).to be_kind_of(OpenSSL::X509::Certificate)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby-keychain-0.4.0 spec/certificate_spec.rb
ruby-keychain-0.3.2 spec/certificate_spec.rb
ruby-keychain-0.3.1 spec/certificate_spec.rb
ruby-keychain-0.3.0 spec/certificate_spec.rb
ruby-keychain-0.2.1 spec/certificate_spec.rb
ruby-keychain-0.2.0 spec/certificate_spec.rb