diff options
Diffstat (limited to 'spec/models/commit_signatures')
-rw-r--r-- | spec/models/commit_signatures/gpg_signature_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/commit_signatures/ssh_signature_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/commit_signatures/x509_commit_signature_spec.rb | 11 |
3 files changed, 22 insertions, 18 deletions
diff --git a/spec/models/commit_signatures/gpg_signature_spec.rb b/spec/models/commit_signatures/gpg_signature_spec.rb index 6ae2a202b72..605ad725dd7 100644 --- a/spec/models/commit_signatures/gpg_signature_spec.rb +++ b/spec/models/commit_signatures/gpg_signature_spec.rb @@ -5,12 +5,14 @@ require 'spec_helper' RSpec.describe CommitSignatures::GpgSignature do # This commit is seeded from https://gitlab.com/gitlab-org/gitlab-test # For instructions on how to add more seed data, see the project README - let(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } - let!(:project) { create(:project, :repository, path: 'sample-project') } - let!(:commit) { create(:commit, project: project, sha: commit_sha) } - let(:signature) { create(:gpg_signature, commit_sha: commit_sha) } - let(:gpg_key) { create(:gpg_key) } - let(:gpg_key_subkey) { create(:gpg_key_subkey) } + let_it_be(:commit_sha) { '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33' } + let_it_be(:project) { create(:project, :repository, path: 'sample-project') } + let_it_be(:commit) { create(:commit, project: project, sha: commit_sha) } + let_it_be(:gpg_key) { create(:gpg_key) } + let_it_be(:gpg_key_subkey) { create(:gpg_key_subkey, gpg_key: gpg_key) } + + let(:signature) { create(:gpg_signature, commit_sha: commit_sha, gpg_key: gpg_key) } + let(:attributes) do { commit_sha: commit_sha, @@ -35,8 +37,7 @@ RSpec.describe CommitSignatures::GpgSignature do end describe '.by_commit_sha scope' do - let(:gpg_key) { create(:gpg_key, key: GpgHelpers::User2.public_key) } - let!(:another_gpg_signature) { create(:gpg_signature, gpg_key: gpg_key) } + let_it_be(:another_gpg_signature) { create(:gpg_signature, gpg_key: gpg_key) } it 'returns all gpg signatures by sha' do expect(described_class.by_commit_sha(commit_sha)).to match_array([signature]) diff --git a/spec/models/commit_signatures/ssh_signature_spec.rb b/spec/models/commit_signatures/ssh_signature_spec.rb index 64d95fe3a71..08530bf6964 100644 --- a/spec/models/commit_signatures/ssh_signature_spec.rb +++ b/spec/models/commit_signatures/ssh_signature_spec.rb @@ -5,11 +5,11 @@ require 'spec_helper' RSpec.describe CommitSignatures::SshSignature do # This commit is seeded from https://gitlab.com/gitlab-org/gitlab-test # For instructions on how to add more seed data, see the project README - let(:commit_sha) { '7b5160f9bb23a3d58a0accdbe89da13b96b1ece9' } - let!(:project) { create(:project, :repository, path: 'sample-project') } - let!(:commit) { create(:commit, project: project, sha: commit_sha) } - let(:signature) { create(:ssh_signature, commit_sha: commit_sha) } - let(:ssh_key) { create(:ed25519_key_256) } + let_it_be(:commit_sha) { '7b5160f9bb23a3d58a0accdbe89da13b96b1ece9' } + let_it_be(:project) { create(:project, :repository, path: 'sample-project') } + let_it_be(:commit) { create(:commit, project: project, sha: commit_sha) } + let_it_be(:ssh_key) { create(:ed25519_key_256) } + let(:attributes) do { commit_sha: commit_sha, @@ -18,6 +18,8 @@ RSpec.describe CommitSignatures::SshSignature do } end + let(:signature) { create(:ssh_signature, commit_sha: commit_sha, key: ssh_key) } + it_behaves_like 'having unique enum values' it_behaves_like 'commit signature' diff --git a/spec/models/commit_signatures/x509_commit_signature_spec.rb b/spec/models/commit_signatures/x509_commit_signature_spec.rb index beb101cdd89..b971fd078e2 100644 --- a/spec/models/commit_signatures/x509_commit_signature_spec.rb +++ b/spec/models/commit_signatures/x509_commit_signature_spec.rb @@ -5,11 +5,10 @@ require 'spec_helper' RSpec.describe CommitSignatures::X509CommitSignature do # This commit is seeded from https://gitlab.com/gitlab-org/gitlab-test # For instructions on how to add more seed data, see the project README - let(:commit_sha) { '189a6c924013fc3fe40d6f1ec1dc20214183bc97' } - let(:project) { create(:project, :public, :repository) } - let!(:commit) { create(:commit, project: project, sha: commit_sha) } - let(:x509_certificate) { create(:x509_certificate) } - let(:signature) { create(:x509_commit_signature, commit_sha: commit_sha) } + let_it_be(:commit_sha) { '189a6c924013fc3fe40d6f1ec1dc20214183bc97' } + let_it_be(:project) { create(:project, :public, :repository) } + let_it_be(:commit) { create(:commit, project: project, sha: commit_sha) } + let_it_be(:x509_certificate) { create(:x509_certificate) } let(:attributes) do { @@ -20,6 +19,8 @@ RSpec.describe CommitSignatures::X509CommitSignature do } end + let(:signature) { create(:x509_commit_signature, commit_sha: commit_sha, x509_certificate: x509_certificate) } + it_behaves_like 'having unique enum values' it_behaves_like 'commit signature' |