Commit 8afd0381 authored by Robert Speicher's avatar Robert Speicher

Remove magic SHAs from GPG badge feature spec

We're trying to give the arbitrary SHAs required by each spec a
meaningful name.

This also adds an explicit `ref` definition to each spec so we're not
dealing with a mystery guest.
parent 9250de6a
# frozen_string_literal: true
require 'spec_helper' require 'spec_helper'
describe 'GPG signed commits', :js do describe 'GPG signed commits', :js do
...@@ -61,8 +63,7 @@ describe 'GPG signed commits', :js do ...@@ -61,8 +63,7 @@ describe 'GPG signed commits', :js do
end end
end end
context 'shows popover badges' do context 'shows popover badges', :js do
let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA }
let(:user_1) do let(:user_1) do
create :user, email: GpgHelpers::User1.emails.first, username: 'nannie.bernhard', name: 'Nannie Bernhard' create :user, email: GpgHelpers::User1.emails.first, username: 'nannie.bernhard', name: 'Nannie Bernhard'
end end
...@@ -87,7 +88,7 @@ describe 'GPG signed commits', :js do ...@@ -87,7 +88,7 @@ describe 'GPG signed commits', :js do
end end
it 'unverified signature' do it 'unverified signature' do
visit project_commit_path(project, ref) visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
click_on 'Unverified' click_on 'Unverified'
...@@ -98,11 +99,9 @@ describe 'GPG signed commits', :js do ...@@ -98,11 +99,9 @@ describe 'GPG signed commits', :js do
end end
it 'unverified signature: user email does not match the committer email, but is the same user' do it 'unverified signature: user email does not match the committer email, but is the same user' do
ref = 'a17a9f66543673edf0a3d1c6b93bdda3fe600f32'
user_2_key user_2_key
visit project_commit_path(project, ref) visit project_commit_path(project, GpgHelpers::DIFFERING_EMAIL_SHA)
click_on 'Unverified' click_on 'Unverified'
...@@ -117,7 +116,7 @@ describe 'GPG signed commits', :js do ...@@ -117,7 +116,7 @@ describe 'GPG signed commits', :js do
it 'unverified signature: user email does not match the committer email' do it 'unverified signature: user email does not match the committer email' do
user_2_key user_2_key
visit project_commit_path(project, ref) visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
click_on 'Unverified' click_on 'Unverified'
...@@ -130,11 +129,9 @@ describe 'GPG signed commits', :js do ...@@ -130,11 +129,9 @@ describe 'GPG signed commits', :js do
end end
it 'verified and the gpg user has a gitlab profile' do it 'verified and the gpg user has a gitlab profile' do
ref = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
user_1_key user_1_key
visit project_commit_path(project, ref) visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
click_on 'Verified' click_on 'Verified'
...@@ -147,11 +144,9 @@ describe 'GPG signed commits', :js do ...@@ -147,11 +144,9 @@ describe 'GPG signed commits', :js do
end end
it "verified and the gpg user's profile doesn't exist anymore" do it "verified and the gpg user's profile doesn't exist anymore" do
ref = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
user_1_key user_1_key
visit project_commit_path(project, ref) visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
# wait for the signature to get generated # wait for the signature to get generated
expect(page).to have_content 'Verified' expect(page).to have_content 'Verified'
......
# frozen_string_literal: true
module GpgHelpers module GpgHelpers
SIGNED_COMMIT_SHA = '8a852d50dda17cc8fd1408d2fd0c5b0f24c76ca4'.freeze SIGNED_COMMIT_SHA = '8a852d50dda17cc8fd1408d2fd0c5b0f24c76ca4'
SIGNED_AND_AUTHORED_SHA = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
DIFFERING_EMAIL_SHA = 'a17a9f66543673edf0a3d1c6b93bdda3fe600f32'
module User1 module User1
extend self extend self
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment