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
Boxiang Sun
gitlab-ce
Commits
5ce61120
Commit
5ce61120
authored
Feb 23, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use example gpg key instead of my own
parent
597ae6e2
Changes
4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
92 additions
and
211 deletions
+92
-211
spec/features/profiles/gpg_keys_spec.rb
spec/features/profiles/gpg_keys_spec.rb
+4
-4
spec/lib/gitlab/gpg_spec.rb
spec/lib/gitlab/gpg_spec.rb
+6
-6
spec/models/gpg_key_spec.rb
spec/models/gpg_key_spec.rb
+4
-4
spec/support/gpg_helpers.rb
spec/support/gpg_helpers.rb
+78
-197
No files found.
spec/features/profiles/gpg_keys_spec.rb
View file @
5ce61120
...
...
@@ -16,8 +16,8 @@ feature 'Profile > GPG Keys', :gpg do
fill_in
(
'Key'
,
with:
attributes_for
(
:gpg_key
)[
:key
])
click_button
(
'Add key'
)
expect
(
page
).
to
have_content
(
'mail@koffeinfrei.org lex@panter.ch'
)
expect
(
page
).
to
have_content
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
expect
(
page
).
to
have_content
(
GpgHelpers
::
User1
.
email
)
expect
(
page
).
to
have_content
(
GpgHelpers
::
User1
.
fingerprint
)
end
end
...
...
@@ -25,8 +25,8 @@ feature 'Profile > GPG Keys', :gpg do
create
(
:gpg_key
,
user:
user
)
visit
profile_gpg_keys_path
expect
(
page
).
to
have_content
(
'mail@koffeinfrei.org lex@panter.ch'
)
expect
(
page
).
to
have_content
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
expect
(
page
).
to
have_content
(
GpgHelpers
::
User1
.
email
)
expect
(
page
).
to
have_content
(
GpgHelpers
::
User1
.
fingerprint
)
end
scenario
'User removes a key via the key index'
do
...
...
spec/lib/gitlab/gpg_spec.rb
View file @
5ce61120
...
...
@@ -5,7 +5,7 @@ describe Gitlab::Gpg do
it
'returns the fingerprint'
do
expect
(
described_class
.
fingerprints_from_key
(
GpgHelpers
::
User1
.
public_key
)
).
to
eq
[
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
]
).
to
eq
[
GpgHelpers
::
User1
.
fingerprint
]
end
it
'returns an empty array when the key is invalid'
do
...
...
@@ -17,22 +17,22 @@ describe Gitlab::Gpg do
describe
'.add_to_keychain'
,
:gpg
do
it
'stores the key in the keychain'
do
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
GpgHelpers
::
User1
.
fingerprint
)).
to
eq
[]
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
::
User1
.
public_key
)
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
GpgHelpers
::
User1
.
fingerprint
)).
not_to
eq
[]
end
end
describe
'.remove_from_keychain'
,
:gpg
do
it
'removes the key from the keychain'
do
Gitlab
::
Gpg
.
add_to_keychain
(
GpgHelpers
::
User1
.
public_key
)
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
not_to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
GpgHelpers
::
User1
.
fingerprint
)).
not_to
eq
[]
Gitlab
::
Gpg
.
remove_from_keychain
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
Gitlab
::
Gpg
.
remove_from_keychain
(
GpgHelpers
::
User1
.
fingerprint
)
expect
(
GPGME
::
Key
.
find
(
:public
,
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)).
to
eq
[]
expect
(
GPGME
::
Key
.
find
(
:public
,
GpgHelpers
::
User1
.
fingerprint
)).
to
eq
[]
end
end
end
spec/models/gpg_key_spec.rb
View file @
5ce61120
...
...
@@ -18,7 +18,7 @@ describe GpgKey do
it
'extracts the fingerprint from the gpg key'
do
gpg_key
=
described_class
.
new
(
key:
GpgHelpers
::
User1
.
public_key
)
gpg_key
.
valid?
expect
(
gpg_key
.
fingerprint
).
to
eq
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
expect
(
gpg_key
.
fingerprint
).
to
eq
GpgHelpers
::
User1
.
fingerprint
end
end
...
...
@@ -34,7 +34,7 @@ describe GpgKey do
allow
(
Gitlab
::
Gpg
).
to
receive
:add_to_keychain
gpg_key
=
create
:gpg_key
expect
(
Gitlab
::
Gpg
).
to
receive
(
:remove_from_keychain
).
with
(
'4F4840A503964251CF7D7F5DC728AF10972E97C0'
)
expect
(
Gitlab
::
Gpg
).
to
receive
(
:remove_from_keychain
).
with
(
GpgHelpers
::
User1
.
fingerprint
)
gpg_key
.
destroy!
end
...
...
@@ -57,9 +57,9 @@ describe GpgKey do
describe
'#emails'
,
:gpg
do
it
'returns the emails from the gpg key'
do
gpg_key
=
create
:gpg_key
gpg_key
=
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
expect
(
gpg_key
.
emails
).
to
match_array
%w(mail@koffeinfrei.org lex@panter.ch)
expect
(
gpg_key
.
emails
).
to
eq
[
GpgHelpers
::
User1
.
email
]
end
end
end
spec/support/gpg_helpers.rb
View file @
5ce61120
This diff is collapsed.
Click to expand it.
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