diff options
author | Robert Speicher <rspeicher@gmail.com> | 2018-11-21 19:33:36 +0100 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2018-11-26 09:39:42 -0600 |
commit | ee17268690eba03a3f5e7086f0a679f815a84888 (patch) | |
tree | 42ab029dc8e203bf401b8ec5d4baca9a0cc0f568 /spec/features/signed_commits_spec.rb | |
parent | 8afd0381229978faa5d3111e37656f7ebf63ab89 (diff) | |
download | gitlab-ce-ee17268690eba03a3f5e7086f0a679f815a84888.tar.gz |
Simplify "changes to verified" GPG feature specs
Previously, we wasted time creating a maintainer and signing them in,
then loaded the entire commit list just to verify the GPG status of a
single commit.
Now, we rely on the project being public so no user needs to be
authenticated, and load just the page for the commit we care about.
Diffstat (limited to 'spec/features/signed_commits_spec.rb')
-rw-r--r-- | spec/features/signed_commits_spec.rb | 47 |
1 files changed, 17 insertions, 30 deletions
diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb index 1efe94e727e..10b6900799f 100644 --- a/spec/features/signed_commits_spec.rb +++ b/spec/features/signed_commits_spec.rb @@ -2,26 +2,21 @@ require 'spec_helper' -describe 'GPG signed commits', :js do - let(:ref) { '2d1096e3a0ecf1d2baf6dee036cc80775d4940ba' } +describe 'GPG signed commits' do let(:project) { create(:project, :public, :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.add_maintainer(user) + ref = GpgHelpers::SIGNED_AND_AUTHORED_SHA + user = create(:user, email: 'unrelated.user@example.org') perform_enqueued_jobs do create :gpg_key, key: GpgHelpers::User1.public_key, user: user end - sign_in(user) + visit project_commit_path(project, ref) - visit project_commits_path(project, ref) - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).not_to have_content 'Verified' - end + expect(page).to have_content 'Unverified' + expect(page).not_to have_content 'Verified' # user changes his email which makes the gpg key verified perform_enqueued_jobs do @@ -29,38 +24,30 @@ describe 'GPG signed commits', :js do user.update!(email: GpgHelpers::User1.emails.first) end - visit project_commits_path(project, ref) + visit project_commit_path(project, ref) - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).to have_content 'Verified' - end + expect(page).not_to have_content 'Unverified' + expect(page).to have_content 'Verified' 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.add_maintainer(user) + ref = GpgHelpers::SIGNED_AND_AUTHORED_SHA + user = create(:user, email: GpgHelpers::User1.emails.first) - sign_in(user) + visit project_commit_path(project, ref) - visit project_commits_path(project, ref) - - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).not_to have_content 'Verified' - end + expect(page).to have_content 'Unverified' + expect(page).not_to have_content 'Verified' # user adds the gpg key which makes the signature valid perform_enqueued_jobs do create :gpg_key, key: GpgHelpers::User1.public_key, user: user end - visit project_commits_path(project, ref) + visit project_commit_path(project, ref) - within '#commits-list' do - expect(page).to have_content 'Unverified' - expect(page).to have_content 'Verified' - end + expect(page).not_to have_content 'Unverified' + expect(page).to have_content 'Verified' end context 'shows popover badges', :js do |