summaryrefslogtreecommitdiff
path: root/spec/models/x509_certificate_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/x509_certificate_spec.rb')
-rw-r--r--spec/models/x509_certificate_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/models/x509_certificate_spec.rb b/spec/models/x509_certificate_spec.rb
index 187d37334a1..880c5014a84 100644
--- a/spec/models/x509_certificate_spec.rb
+++ b/spec/models/x509_certificate_spec.rb
@@ -43,6 +43,28 @@ RSpec.describe X509Certificate do
expect(certificate.subject).to eq(subject)
expect(certificate.email).to eq(email)
end
+
+ it 'calls mark_commit_signatures_unverified' do
+ expect_any_instance_of(described_class).to receive(:mark_commit_signatures_unverified)
+
+ described_class.safe_create!(attributes)
+ end
+
+ context 'certificate revocation handling' do
+ let(:x509_certificate) { create(:x509_certificate) }
+
+ it 'starts a revoke worker if certificate is revoked' do
+ expect(X509CertificateRevokeWorker).to receive(:perform_async).with(x509_certificate.id)
+
+ x509_certificate.revoked!
+ end
+
+ it 'does not starts a revoke worker for good certificates' do
+ expect(X509CertificateRevokeWorker).not_to receive(:perform_async).with(x509_certificate.id)
+
+ x509_certificate
+ end
+ end
end
describe 'validators' do