summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2018-11-21 19:32:04 +0100
committerRobert Speicher <rspeicher@gmail.com>2018-11-26 09:39:42 -0600
commit8afd0381229978faa5d3111e37656f7ebf63ab89 (patch)
tree9ea96fba4a2d44ab3dd0e1172352b79b6ddea091 /spec
parent9250de6aba0d9d1f0c0a0651c9d87d47570ac103 (diff)
downloadgitlab-ce-8afd0381229978faa5d3111e37656f7ebf63ab89.tar.gz
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.
Diffstat (limited to 'spec')
-rw-r--r--spec/features/signed_commits_spec.rb21
-rw-r--r--spec/support/helpers/gpg_helpers.rb6
2 files changed, 13 insertions, 14 deletions
diff --git a/spec/features/signed_commits_spec.rb b/spec/features/signed_commits_spec.rb
index 22b47a9cb49..1efe94e727e 100644
--- a/spec/features/signed_commits_spec.rb
+++ b/spec/features/signed_commits_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require 'spec_helper'
describe 'GPG signed commits', :js do
@@ -61,8 +63,7 @@ describe 'GPG signed commits', :js do
end
end
- context 'shows popover badges' do
- let(:ref) { GpgHelpers::SIGNED_COMMIT_SHA }
+ context 'shows popover badges', :js do
let(:user_1) do
create :user, email: GpgHelpers::User1.emails.first, username: 'nannie.bernhard', name: 'Nannie Bernhard'
end
@@ -87,7 +88,7 @@ describe 'GPG signed commits', :js do
end
it 'unverified signature' do
- visit project_commit_path(project, ref)
+ visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
click_on 'Unverified'
@@ -98,11 +99,9 @@ describe 'GPG signed commits', :js do
end
it 'unverified signature: user email does not match the committer email, but is the same user' do
- ref = 'a17a9f66543673edf0a3d1c6b93bdda3fe600f32'
-
user_2_key
- visit project_commit_path(project, ref)
+ visit project_commit_path(project, GpgHelpers::DIFFERING_EMAIL_SHA)
click_on 'Unverified'
@@ -117,7 +116,7 @@ describe 'GPG signed commits', :js do
it 'unverified signature: user email does not match the committer email' do
user_2_key
- visit project_commit_path(project, ref)
+ visit project_commit_path(project, GpgHelpers::SIGNED_COMMIT_SHA)
click_on 'Unverified'
@@ -130,11 +129,9 @@ describe 'GPG signed commits', :js do
end
it 'verified and the gpg user has a gitlab profile' do
- ref = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
-
user_1_key
- visit project_commit_path(project, ref)
+ visit project_commit_path(project, GpgHelpers::SIGNED_AND_AUTHORED_SHA)
click_on 'Verified'
@@ -147,11 +144,9 @@ describe 'GPG signed commits', :js do
end
it "verified and the gpg user's profile doesn't exist anymore" do
- ref = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
-
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
expect(page).to have_content 'Verified'
diff --git a/spec/support/helpers/gpg_helpers.rb b/spec/support/helpers/gpg_helpers.rb
index 3f7279a50e0..8d1637228d0 100644
--- a/spec/support/helpers/gpg_helpers.rb
+++ b/spec/support/helpers/gpg_helpers.rb
@@ -1,5 +1,9 @@
+# frozen_string_literal: true
+
module GpgHelpers
- SIGNED_COMMIT_SHA = '8a852d50dda17cc8fd1408d2fd0c5b0f24c76ca4'.freeze
+ SIGNED_COMMIT_SHA = '8a852d50dda17cc8fd1408d2fd0c5b0f24c76ca4'
+ SIGNED_AND_AUTHORED_SHA = '3c1d9a0266cb0c62d926f4a6c649beed561846f5'
+ DIFFERING_EMAIL_SHA = 'a17a9f66543673edf0a3d1c6b93bdda3fe600f32'
module User1
extend self