summaryrefslogtreecommitdiff
path: root/spec/lib/gitlab
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-08-24 14:21:38 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-09-05 12:18:31 +0200
commit2a89037b63967aac0725cf4e122cecbe0c3c5596 (patch)
treede59a3c5f5998aa3e5042148abe423f59ceca1f2 /spec/lib/gitlab
parentc5e0bd56fbc0f13e107e6553ea817c130d947ab1 (diff)
downloadgitlab-ce-2a89037b63967aac0725cf4e122cecbe0c3c5596.tar.gz
downcase gpg key's emails
this is necessary for email comparisons
Diffstat (limited to 'spec/lib/gitlab')
-rw-r--r--spec/lib/gitlab/gpg_spec.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/lib/gitlab/gpg_spec.rb b/spec/lib/gitlab/gpg_spec.rb
index 30ad033b204..11a2aea1915 100644
--- a/spec/lib/gitlab/gpg_spec.rb
+++ b/spec/lib/gitlab/gpg_spec.rb
@@ -42,6 +42,21 @@ describe Gitlab::Gpg do
described_class.user_infos_from_key('bogus')
).to eq []
end
+
+ it 'downcases the email' do
+ public_key = double(:key)
+ fingerprints = double(:fingerprints)
+ uid = double(:uid, name: 'Nannie Bernhard', email: 'NANNIE.BERNHARD@EXAMPLE.COM')
+ raw_key = double(:raw_key, uids: [uid])
+ allow(Gitlab::Gpg::CurrentKeyChain).to receive(:fingerprints_from_key).with(public_key).and_return(fingerprints)
+ allow(GPGME::Key).to receive(:find).with(:public, anything).and_return([raw_key])
+
+ user_infos = described_class.user_infos_from_key(public_key)
+ expect(user_infos).to eq([{
+ name: 'Nannie Bernhard',
+ email: 'nannie.bernhard@example.com'
+ }])
+ end
end
describe '.current_home_dir' do