Sha256: d642cbca21363fdc3c78622edbac23cfbbd0e0b894355be79f2f08f37ca65aef
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
require 'spec_helper' require 'helpers/certmeister_config_helper' require 'certmeister' describe Certmeister::SelfTest do subject { Certmeister::SelfTest.new(ca, File.read('fixtures/client.key')) } describe "#test(req = {cn: 'test', ip: '127.0.0.1'})" do context "when the CA is functioning correctly" do let(:ca) { Certmeister.new(CertmeisterConfigHelper::valid_config) } it "returns success" do res = subject.test(cn: 'test', ip: '127.0.0.1') expect(res).to be_ok end end context "when the CA is malfunctioning" do let(:store) { Certmeister::InMemoryStore.new.tap { |o| o.send(:break!) } } let(:ca) { Certmeister.new(CertmeisterConfigHelper::custom_config(store: store)) } it "returns an error" do res = subject.test(cn: 'test', ip: '127.0.0.1') expect(res).to_not be_ok end it "provides an error message in the response data" do res = subject.test(cn: 'test', ip: '127.0.0.1') expect(res.data[:message]).to match /in-memory store is broken/ end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
certmeister-1.1.0 | spec/certmeister/self_test_spec.rb |