diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-02-24 22:07:57 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 16:40:41 +0300 |
commit | 0e3d3d60bae48f3698f9e7b0e060edb67170b11e (patch) | |
tree | 56bbe22a0f589574aa8b7d21271ba3a610b1c418 /spec/lib/gitlab/gpg_spec.rb | |
parent | 41c96c45f2696af54dde81271741a6342db5d55a (diff) |
email handling for gpg keys
Diffstat (limited to 'spec/lib/gitlab/gpg_spec.rb')
-rw-r--r-- | spec/lib/gitlab/gpg_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb index 6cfc634e2d9..2a55e7d89de 100644 --- a/spec/lib/gitlab/gpg_spec.rb +++ b/spec/lib/gitlab/gpg_spec.rb @@ -15,6 +15,20 @@ describe Gitlab::Gpg do end end + 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 + describe '.add_to_keychain', :gpg do it 'stores the key in the keychain' do expect(GPGME::Key.find(:public, GpgHelpers::User1.fingerprint)).to eq [] @@ -36,3 +50,15 @@ describe Gitlab::Gpg do end end end + +describe Gitlab::Gpg::CurrentKeyChain, :gpg do + describe '.emails' do + it 'returns the emails' do + Gitlab::Gpg.add_to_keychain(GpgHelpers::User2.public_key) + + expect( + described_class.emails(GpgHelpers::User2.fingerprint) + ).to match_array GpgHelpers::User2.emails + end + end +end |