Sha256: 32e3f0628f6b3bd0132e61adcadb6696020c23c8b00c206ef1a0b90226330f79

Contents?: true

Size: 1.01 KB

Versions: 17

Compression:

Stored size: 1.01 KB

Contents

require 'spec_helper'

describe Billy::CertificateChain do
  let(:cert1) { Billy::Certificate.new('localhost') }
  let(:cert2) { Billy::Certificate.new('localhost.localdomain') }
  let(:chain) do
    Billy::CertificateChain.new('localhost', cert1.cert, cert2.cert)
  end

  context('#initialize') do
    it 'holds all certificates in order' do
      expect(chain.certificates).to be_eql([cert1.cert, cert2.cert])
    end

    it 'holds the domain' do
      expect(chain.domain).to be_eql('localhost')
    end
  end

  context('#file') do
    it 'pass back the path' do
      expect(chain.file).to match(/chain-localhost.pem/)
    end

    it 'writes out all certificates' do
      chain.certificates.each do |cert|
        expect(File.read(chain.file)).to include(cert.to_pem)
      end
    end

    it 'creates a temporary file' do
      expect(File.exist?(chain.file)).to be(true)
    end

    it 'creates a PEM formatted certificate chain' do
      expect(File.read(chain.file)).to match(/^[A-Za-z0-9\-\+\/\=]+$/)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
puffing-billy-3.0.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.4.1 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.4.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.3.1 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.3.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.2.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.1.1 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.1.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-2.0.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-1.1.3 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-1.1.2 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-1.1.1 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-1.1.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-1.0.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-0.12.0 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-0.11.1 spec/lib/billy/ssl/certificate_chain_spec.rb
puffing-billy-0.11.0 spec/lib/billy/ssl/certificate_chain_spec.rb