Sha256: 24e7c58d24706270a2bba062d5fcfa48f23982890da5a99f3f42bd75bde855b3
Contents?: true
Size: 957 Bytes
Versions: 6
Compression:
Stored size: 957 Bytes
Contents
# frozen_string_literal: true RSpec.describe Rails::Auth::X509::Matcher do let(:example_cert) { OpenSSL::X509::Certificate.new(cert_path("valid.crt").read) } let(:example_certificate) { Rails::Auth::X509::Certificate.new(example_cert) } let(:example_ou) { "ponycopter" } let(:another_ou) { "somethingelse" } let(:example_env) do { Rails::Auth::Env::CREDENTIALS_ENV_KEY => { "x509" => example_certificate } } end describe "#match" do it "matches against a valid Rails::Auth::X509::Credential" do matcher = described_class.new(ou: example_ou) expect(matcher.match(example_env)).to eq true end it "doesn't match if the subject mismatches" do matcher = described_class.new(ou: another_ou) expect(matcher.match(example_env)).to eq false end end it "knows its attributes" do matcher = described_class.new(ou: example_ou) expect(matcher.attributes).to eq(ou: example_ou) end end
Version data entries
6 entries across 6 versions & 1 rubygems