Sha256: afbe6554b52cfd1fdf12beb559fcf3f505f7f2dca0b73c6a46133c002c8885fa

Contents?: true

Size: 1.49 KB

Versions: 3

Compression:

Stored size: 1.49 KB

Contents

require File.dirname(__FILE__) + '/units_helper'

describe CertificateAuthority::DistinguishedName do
  before(:each) do
    @distinguished_name = CertificateAuthority::DistinguishedName.new
  end
  
  it "should provide the standard x.509 distinguished name common attributes" do
    @distinguished_name.respond_to?(:cn).should be_true
    @distinguished_name.respond_to?(:l).should be_true
    @distinguished_name.respond_to?(:s).should be_true
    @distinguished_name.respond_to?(:o).should be_true
    @distinguished_name.respond_to?(:ou).should be_true
    @distinguished_name.respond_to?(:c).should be_true
  end
  
  it "should provide human-readable equivalents to the distinguished name common attributes" do
    @distinguished_name.respond_to?(:common_name).should be_true
    @distinguished_name.respond_to?(:locality).should be_true
    @distinguished_name.respond_to?(:state).should be_true
    @distinguished_name.respond_to?(:organization).should be_true
    @distinguished_name.respond_to?(:organizational_unit).should be_true
    @distinguished_name.respond_to?(:country).should be_true
  end
  
  it "should require a common name" do
    @distinguished_name.valid?.should be_false
    @distinguished_name.errors.size.should == 1
    @distinguished_name.common_name = "chrischandler.name"
    @distinguished_name.valid?.should be_true
  end
  
  it "should be convertible to an OpenSSL::X509::Name" do
    @distinguished_name.common_name = "chrischandler.name"
    @distinguished_name.to_x509_name
  end
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
certificate_authority-0.1.3 spec/units/distinguished_name_spec.rb
certificate_authority-0.1.2 spec/units/distinguished_name_spec.rb
certificate_authority-0.1.1 spec/units/distinguished_name_spec.rb