summaryrefslogtreecommitdiff
path: root/spec/helpers/x509_helper_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/helpers/x509_helper_spec.rb')
-rw-r--r--spec/helpers/x509_helper_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/helpers/x509_helper_spec.rb b/spec/helpers/x509_helper_spec.rb
index dcdf57ce035..db3f6158195 100644
--- a/spec/helpers/x509_helper_spec.rb
+++ b/spec/helpers/x509_helper_spec.rb
@@ -57,4 +57,22 @@ describe X509Helper do
end
end
end
+
+ describe '#x509_signature?' do
+ let(:x509_signature) { create(:x509_commit_signature) }
+ let(:gpg_signature) { create(:gpg_signature) }
+
+ it 'detects a x509 signed commit' do
+ signature = Gitlab::X509::Signature.new(
+ X509Helpers::User1.signed_commit_signature,
+ X509Helpers::User1.signed_commit_base_data,
+ X509Helpers::User1.certificate_email,
+ X509Helpers::User1.signed_commit_time
+ )
+
+ expect(x509_signature?(x509_signature)).to be_truthy
+ expect(x509_signature?(signature)).to be_truthy
+ expect(x509_signature?(gpg_signature)).to be_falsey
+ end
+ end
end