Sha256: b751a22d003449daec2113fa7b0189730755bcbd2bf80dbf4571520e01aec830

Contents?: true

Size: 951 Bytes

Versions: 7

Compression:

Stored size: 951 Bytes

Contents

RSpec.describe Rails::Auth::X509::Certificate do
  let(:example_cert) { OpenSSL::X509::Certificate.new(cert_path("valid.crt").read) }
  let(:example_certificate) { described_class.new(example_cert) }

  let(:example_cn) { "127.0.0.1" }
  let(:example_ou) { "ponycopter" }

  describe "#[]" do
    it "allows access to subject components via strings" do
      expect(example_certificate["CN"]).to eq example_cn
      expect(example_certificate["OU"]).to eq example_ou
    end

    it "allows access to subject components via symbols" do
      expect(example_certificate[:cn]).to eq example_cn
      expect(example_certificate[:ou]).to eq example_ou
    end
  end

  it "knows its #cn" do
    expect(example_certificate.cn).to eq example_cn
  end

  it "knows its #ou" do
    expect(example_certificate.ou).to eq example_ou
  end

  it "knows its attributes" do
    expect(example_certificate.attributes).to eq(cn: example_cn, ou: example_ou)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails-auth-1.0.0 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.5.3 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.5.2 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.5.1 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.5.0 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.4.1 spec/rails/auth/x509/certificate_spec.rb
rails-auth-0.4.0 spec/rails/auth/x509/certificate_spec.rb