gitlab-org--gitlab-foss/spec/lib/gitlab/gpg_spec.rb

46 lines
1.1 KiB
Ruby
Raw Normal View History

2017-02-22 16:20:42 +00:00
require 'rails_helper'
describe Gitlab::Gpg do
describe '.fingerprints_from_key' do
it 'returns the fingerprint' do
expect(
2017-02-23 11:02:36 +00:00
described_class.fingerprints_from_key(GpgHelpers::User1.public_key)
2017-02-23 13:07:51 +00:00
).to eq [GpgHelpers::User1.fingerprint]
2017-02-22 16:20:42 +00:00
end
it 'returns an empty array when the key is invalid' do
expect(
described_class.fingerprints_from_key('bogus')
).to eq []
end
end
describe '.primary_keyids_from_key' do
it 'returns the keyid' do
expect(
described_class.primary_keyids_from_key(GpgHelpers::User1.public_key)
).to eq [GpgHelpers::User1.primary_keyid]
end
it 'returns an empty array when the key is invalid' do
expect(
described_class.primary_keyids_from_key('bogus')
).to eq []
end
end
2017-02-24 19:07:57 +00:00
describe '.emails_from_key' do
it 'returns the emails' do
expect(
described_class.emails_from_key(GpgHelpers::User1.public_key)
).to eq GpgHelpers::User1.emails
end
it 'returns an empty array when the key is invalid' do
expect(
described_class.emails_from_key('bogus')
).to eq []
end
end
end