summaryrefslogtreecommitdiff
path: root/spec/features/commits_spec.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-06-22 08:47:11 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:43:36 +0200
commit9d30a80d24a583aad267a8a11f685058eab2c864 (patch)
treec935f7b612112175819c7fe46ac8cdac62bda2f2 /spec/features/commits_spec.rb
parenta01eabc19f0d5b73f6216edc10d19a7765c73b53 (diff)
downloadgitlab-ce-9d30a80d24a583aad267a8a11f685058eab2c864.tar.gz
update features specs for gpg commits
Diffstat (limited to 'spec/features/commits_spec.rb')
-rw-r--r--spec/features/commits_spec.rb51
1 files changed, 38 insertions, 13 deletions
diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb
index 1dbcf09d4a0..8f89b465160 100644
--- a/spec/features/commits_spec.rb
+++ b/spec/features/commits_spec.rb
@@ -206,36 +206,51 @@ describe 'Commits' do
end
describe 'GPG signed commits' do
- let!(:user) { create :user, email: GpgHelpers::User1.emails.first }
- let!(:gpg_key) { create :gpg_key, key: GpgHelpers::User1.public_key, user: user }
-
before do
- project.team << [user, :master]
- login_with(user)
- end
-
- it 'shows the signed status', :gpg do
# FIXME: add this to the test repository directly
remote_path = project.repository.path_to_repo
Dir.mktmpdir do |dir|
FileUtils.cd dir do
`git clone --quiet #{remote_path} .`
- `git commit --quiet -S#{GpgHelpers::User1.primary_keyid} --allow-empty -m "signed commit, verified key/email"`
- `git commit --quiet -S#{GpgHelpers::User2.primary_keyid} --allow-empty -m "signed commit, unverified key/email"`
+ `git commit --quiet -S#{GpgHelpers::User1.primary_keyid} --allow-empty -m "signed commit by nannie bernhard"`
+ `git commit --quiet -S#{GpgHelpers::User2.primary_keyid} --allow-empty -m "signed commit by bette cartwright"`
`git push --quiet`
end
end
+ end
+
+ 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]
+
+ create :gpg_key, key: GpgHelpers::User1.public_key, user: user
+
+ login_with(user)
visit namespace_project_commits_path(project.namespace, project, :master)
within '#commits-list' do
expect(page).to have_content 'Unverified'
- expect(page).to have_content 'Verified'
+ expect(page).not_to have_content 'Verified'
end
- # user changes his email which makes the gpg key unverified
+ # user changes his email which makes the gpg key verified
user.skip_reconfirmation!
- user.update_attributes!(email: 'bette.cartwright@example.org')
+ user.update_attributes!(email: GpgHelpers::User1.emails.first)
+
+ visit namespace_project_commits_path(project.namespace, project, :master)
+
+ 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]
+
+ login_with(user)
visit namespace_project_commits_path(project.namespace, project, :master)
@@ -243,6 +258,16 @@ describe 'Commits' 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
+ create :gpg_key, key: GpgHelpers::User1.public_key, user: user
+
+ visit namespace_project_commits_path(project.namespace, project, :master)
+
+ within '#commits-list' do
+ expect(page).to have_content 'Unverified'
+ expect(page).to have_content 'Verified'
+ end
end
end
end