diff --git a/spec/features/commits_spec.rb b/spec/features/commits_spec.rb index fb1e47994ef4e3fac2ee3ee3abfd23e7245d1116..c303f29a832772d4206ee5fa383813a2c2677498 100644 --- a/spec/features/commits_spec.rb +++ b/spec/features/commits_spec.rb @@ -1,4 +1,5 @@ require 'spec_helper' +require 'fileutils' describe 'Commits' do include CiStatusHelper @@ -203,4 +204,35 @@ describe 'Commits' do end end end + + describe 'GPG signed commits' do + let(:user) { create(:user) } + + before do + project.team << [user, :master] + login_with(user) + end + + it 'shows the signed status', :gpg do + GPGME::Key.import(GpgHelpers::User1.public_key) + + # 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.key_id} --allow-empty -m "signed commit, verified key/email"` + `git commit --quiet -S#{GpgHelpers::User2.key_id} --allow-empty -m "signed commit, unverified key/email"` + `git push --quiet` + end + end + + 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