172 lines
8.8 KiB
Ruby
172 lines
8.8 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe GitHelper do
|
|
describe '#short_sha' do
|
|
let(:short_sha) { helper.short_sha('d4e043f6c20749a3ab3f4b8e23f2a8979f4b9100') }
|
|
|
|
it { expect(short_sha).to eq('d4e043f6') }
|
|
end
|
|
|
|
describe '#strip_signature' do
|
|
context 'strips PGP SIGNATURE' do
|
|
let(:strip_signature) { helper.strip_signature( pgp_signature_tag ) }
|
|
|
|
it { expect(strip_signature).to eq("Version 1.69.0\n\n") }
|
|
end
|
|
|
|
context 'strips PGP MESSAGE' do
|
|
let(:strip_signature) { helper.strip_signature( pgp_message_tag ) }
|
|
|
|
it { expect(strip_signature).to eq("Version 1.69.0\n\n") }
|
|
end
|
|
|
|
context 'strips SIGNED MESSAGE' do
|
|
let(:strip_signature) { helper.strip_signature( x509_message_tag ) }
|
|
|
|
it { expect(strip_signature).to eq("this is Roger's signed tag\n\n") }
|
|
end
|
|
end
|
|
|
|
def pgp_signature_tag
|
|
<<~SIGNATURE
|
|
Version 1.69.0
|
|
-----BEGIN PGP SIGNATURE-----
|
|
|
|
iQEzBAABCAAdFiEEFMo1pwRq9j04Jovq68Q/GjfvLIoFAl2l64QACgkQ68Q/Gjfv
|
|
LIqRDggAm0d1ceVRsfldlwC6guR2ly8aWoTtZZ19E12bsfXd4lJqcQv7JXTP0og0
|
|
cwbV0l92iBJKGW6bFBipKDFmSgr5le5zFsXYOr9bJCQNOhFNMmtAgaHEIeVI16+c
|
|
S3pA+qIe516d4wRs/hcbxDJKC68iIlDaLXObdzTTLGMgbCYBFTjYJldNUfTkdvbB
|
|
oGEpFXuxV9EyfBtPLsz2vUea5GdZcRSVyJbcgm9ZU+ekdLZckroP5M0I5SQTbD3y
|
|
VrbCY3ziYtau4zK4cV66ybRz1G7tR6dcoC4kGUbaZlKsVZ1Af80agx2d9k5MR1wS
|
|
4OFe1H0zIfpPRFsyX2toaum3EX6QBA==
|
|
=hefg
|
|
-----END PGP SIGNATURE-----
|
|
SIGNATURE
|
|
end
|
|
|
|
def pgp_message_tag
|
|
<<~SIGNATURE
|
|
Version 1.69.0
|
|
-----BEGIN PGP MESSAGE-----
|
|
|
|
iQEzBAABCAAdFiEEFMo1pwRq9j04Jovq68Q/GjfvLIoFAl2l64QACgkQ68Q/Gjfv
|
|
LIqRDggAm0d1ceVRsfldlwC6guR2ly8aWoTtZZ19E12bsfXd4lJqcQv7JXTP0og0
|
|
cwbV0l92iBJKGW6bFBipKDFmSgr5le5zFsXYOr9bJCQNOhFNMmtAgaHEIeVI16+c
|
|
S3pA+qIe516d4wRs/hcbxDJKC68iIlDaLXObdzTTLGMgbCYBFTjYJldNUfTkdvbB
|
|
oGEpFXuxV9EyfBtPLsz2vUea5GdZcRSVyJbcgm9ZU+ekdLZckroP5M0I5SQTbD3y
|
|
VrbCY3ziYtau4zK4cV66ybRz1G7tR6dcoC4kGUbaZlKsVZ1Af80agx2d9k5MR1wS
|
|
4OFe1H0zIfpPRFsyX2toaum3EX6QBA==
|
|
=hefg
|
|
-----END PGP MESSAGE-----
|
|
SIGNATURE
|
|
end
|
|
|
|
def x509_message_tag
|
|
<<~SIGNATURE
|
|
this is Roger's signed tag
|
|
-----BEGIN SIGNED MESSAGE-----
|
|
MIISfwYJKoZIhvcNAQcCoIIScDCCEmwCAQExDTALBglghkgBZQMEAgEwCwYJKoZI
|
|
hvcNAQcBoIIP8zCCB3QwggVcoAMCAQICBBXXLOIwDQYJKoZIhvcNAQELBQAwgbYx
|
|
CzAJBgNVBAYTAkRFMQ8wDQYDVQQIDAZCYXllcm4xETAPBgNVBAcMCE11ZW5jaGVu
|
|
MRAwDgYDVQQKDAdTaWVtZW5zMREwDwYDVQQFEwhaWlpaWlpBNjEdMBsGA1UECwwU
|
|
U2llbWVucyBUcnVzdCBDZW50ZXIxPzA9BgNVBAMMNlNpZW1lbnMgSXNzdWluZyBD
|
|
QSBNZWRpdW0gU3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