Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
7b7cd6f6
Commit
7b7cd6f6
authored
Feb 22, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add emails method to GgpKey
parent
fbf1fd1a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
app/models/gpg_key.rb
app/models/gpg_key.rb
+5
-0
spec/factories/gpg_keys.rb
spec/factories/gpg_keys.rb
+7
-0
spec/models/gpg_key_spec.rb
spec/models/gpg_key_spec.rb
+8
-0
No files found.
app/models/gpg_key.rb
View file @
7b7cd6f6
...
...
@@ -21,6 +21,11 @@ class GpgKey < ActiveRecord::Base
write_attribute
(
:key
,
value
)
end
def
emails
raw_key
=
GPGME
::
Key
.
get
(
fingerprint
)
raw_key
.
uids
.
map
(
&
:email
)
end
private
def
extract_fingerprint
...
...
spec/factories/gpg_keys.rb
0 → 100644
View file @
7b7cd6f6
require_relative
'../support/gpg_helpers'
FactoryGirl
.
define
do
factory
:gpg_key
do
key
GpgHelpers
.
public_key
end
end
spec/models/gpg_key_spec.rb
View file @
7b7cd6f6
...
...
@@ -38,4 +38,12 @@ describe GpgKey do
expect
(
described_class
.
new
(
key:
"
#{
key
}
"
).
key
).
to
eq
(
key
)
end
end
describe
'#emails'
do
it
'returns the emails from the gpg key'
do
gpg_key
=
create
:gpg_key
expect
(
gpg_key
.
emails
).
to
match_array
%w(mail@koffeinfrei.org lex@panter.ch)
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment