BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
gpg_key.rb
app/models/gpg_key.rb
+5
-0
gpg_keys.rb
spec/factories/gpg_keys.rb
+7
-0
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
...
@@ -21,6 +21,11 @@ class GpgKey < ActiveRecord::Base
write_attribute
(
:key
,
value
)
write_attribute
(
:key
,
value
)
end
end
def
emails
raw_key
=
GPGME
::
Key
.
get
(
fingerprint
)
raw_key
.
uids
.
map
(
&
:email
)
end
private
private
def
extract_fingerprint
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
...
@@ -38,4 +38,12 @@ describe GpgKey do
expect
(
described_class
.
new
(
key:
"
#{
key
}
"
).
key
).
to
eq
(
key
)
expect
(
described_class
.
new
(
key:
"
#{
key
}
"
).
key
).
to
eq
(
key
)
end
end
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
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