diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/gitlab/x509 | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/gitlab/x509')
-rw-r--r-- | spec/lib/gitlab/x509/tag_spec.rb | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/spec/lib/gitlab/x509/tag_spec.rb b/spec/lib/gitlab/x509/tag_spec.rb index b011ea515de..be120aaf16a 100644 --- a/spec/lib/gitlab/x509/tag_spec.rb +++ b/spec/lib/gitlab/x509/tag_spec.rb @@ -2,13 +2,13 @@ require 'spec_helper' RSpec.describe Gitlab::X509::Tag do - subject(:signature) { described_class.new(tag).signature } + subject(:signature) { described_class.new(project.repository, tag).signature } describe '#signature' do let(:repository) { Gitlab::Git::Repository.new('default', TEST_REPO_PATH, '', 'group/project') } let(:project) { create(:project, :repository) } - describe 'signed tag' do + shared_examples 'signed tag' do let(:tag) { project.repository.find_tag('v1.1.1') } let(:certificate_attributes) do { @@ -33,10 +33,24 @@ RSpec.describe Gitlab::X509::Tag do it { expect(signature.x509_certificate.x509_issuer).to have_attributes(issuer_attributes) } end - context 'unsigned tag' do + shared_examples 'unsigned tag' do let(:tag) { project.repository.find_tag('v1.0.0') } it { expect(signature).to be_nil } end + + context 'with :get_tag_signatures enabled' do + it_behaves_like 'signed tag' + it_behaves_like 'unsigned tag' + end + + context 'with :get_tag_signatures disabled' do + before do + stub_feature_flags(get_tag_signatures: false) + end + + it_behaves_like 'signed tag' + it_behaves_like 'unsigned tag' + end end end |