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
e7be70a0
Commit
e7be70a0
authored
Aug 28, 2017
by
Alexis Reigel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract gpg commit specs to their own file
parent
e37c46b6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
101 deletions
+104
-101
spec/features/commits_spec.rb
spec/features/commits_spec.rb
+0
-101
spec/features/signed_commits_spec.rb
spec/features/signed_commits_spec.rb
+104
-0
No files found.
spec/features/commits_spec.rb
View file @
e7be70a0
...
...
@@ -203,105 +203,4 @@ describe 'Commits' do
end
end
end
describe
'GPG signed commits'
,
:js
do
it
'changes from unverified to verified when the user changes his email to match the gpg key'
do
user
=
create
:user
,
email:
'unrelated.user@example.org'
project
.
team
<<
[
user
,
:master
]
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
user
end
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
not_to
have_content
'Verified'
end
# user changes his email which makes the gpg key verified
Sidekiq
::
Testing
.
inline!
do
user
.
skip_reconfirmation!
user
.
update_attributes!
(
email:
GpgHelpers
::
User1
.
emails
.
first
)
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
to
have_content
'Verified'
end
end
it
'changes from unverified to verified when the user adds the missing gpg key'
do
user
=
create
:user
,
email:
GpgHelpers
::
User1
.
emails
.
first
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
not_to
have_content
'Verified'
end
# user adds the gpg key which makes the signature valid
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
user
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
to
have_content
'Verified'
end
end
it
'shows popover badges'
do
gpg_user
=
create
:user
,
email:
GpgHelpers
::
User1
.
emails
.
first
,
username:
'nannie.bernhard'
,
name:
'Nannie Bernhard'
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
gpg_user
end
user
=
create
:user
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
# unverified signature
click_on
'Unverified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with an unverified signature.'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User2
.
primary_keyid
}
"
end
# verified and the gpg user has a gitlab profile
click_on
'Verified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with a verified signature.'
expect
(
page
).
to
have_content
'Nannie Bernhard'
expect
(
page
).
to
have_content
'@nannie.bernhard'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User1
.
primary_keyid
}
"
end
# verified and the gpg user's profile doesn't exist anymore
gpg_user
.
destroy!
visit
project_commits_path
(
project
,
:'signed-commits'
)
click_on
'Verified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with a verified signature.'
expect
(
page
).
to
have_content
'Nannie Bernhard'
expect
(
page
).
to
have_content
'nannie.bernhard@example.com'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User1
.
primary_keyid
}
"
end
end
end
end
spec/features/signed_commits_spec.rb
0 → 100644
View file @
e7be70a0
require
'spec_helper'
describe
'GPG signed commits'
,
:js
do
let
(
:project
)
{
create
(
:project
,
:repository
)
}
it
'changes from unverified to verified when the user changes his email to match the gpg key'
do
user
=
create
:user
,
email:
'unrelated.user@example.org'
project
.
team
<<
[
user
,
:master
]
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
user
end
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
not_to
have_content
'Verified'
end
# user changes his email which makes the gpg key verified
Sidekiq
::
Testing
.
inline!
do
user
.
skip_reconfirmation!
user
.
update_attributes!
(
email:
GpgHelpers
::
User1
.
emails
.
first
)
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
to
have_content
'Verified'
end
end
it
'changes from unverified to verified when the user adds the missing gpg key'
do
user
=
create
:user
,
email:
GpgHelpers
::
User1
.
emails
.
first
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
not_to
have_content
'Verified'
end
# user adds the gpg key which makes the signature valid
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
user
end
visit
project_commits_path
(
project
,
:'signed-commits'
)
within
'#commits-list'
do
expect
(
page
).
to
have_content
'Unverified'
expect
(
page
).
to
have_content
'Verified'
end
end
it
'shows popover badges'
do
gpg_user
=
create
:user
,
email:
GpgHelpers
::
User1
.
emails
.
first
,
username:
'nannie.bernhard'
,
name:
'Nannie Bernhard'
Sidekiq
::
Testing
.
inline!
do
create
:gpg_key
,
key:
GpgHelpers
::
User1
.
public_key
,
user:
gpg_user
end
user
=
create
:user
project
.
team
<<
[
user
,
:master
]
sign_in
(
user
)
visit
project_commits_path
(
project
,
:'signed-commits'
)
# unverified signature
click_on
'Unverified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with an unverified signature.'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User2
.
primary_keyid
}
"
end
# verified and the gpg user has a gitlab profile
click_on
'Verified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with a verified signature.'
expect
(
page
).
to
have_content
'Nannie Bernhard'
expect
(
page
).
to
have_content
'@nannie.bernhard'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User1
.
primary_keyid
}
"
end
# verified and the gpg user's profile doesn't exist anymore
gpg_user
.
destroy!
visit
project_commits_path
(
project
,
:'signed-commits'
)
click_on
'Verified'
,
match: :first
within
'.popover'
do
expect
(
page
).
to
have_content
'This commit was signed with a verified signature.'
expect
(
page
).
to
have_content
'Nannie Bernhard'
expect
(
page
).
to
have_content
'nannie.bernhard@example.com'
expect
(
page
).
to
have_content
"GPG Key ID:
#{
GpgHelpers
::
User1
.
primary_keyid
}
"
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