diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-07 00:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-07 00:09:01 +0300 |
commit | ca3ff7f842fb1e4bf124356a6faccd3e65b7aba3 (patch) | |
tree | befb345c84e172b0592378ca17298f7a0c955a06 /spec/workers/ci | |
parent | 1287690a3678ad0ec21c9b2f3b21ae18257d5e22 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/workers/ci')
-rw-r--r-- | spec/workers/ci/parse_secure_file_metadata_worker_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb b/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb new file mode 100644 index 00000000000..57bbd8a6ff0 --- /dev/null +++ b/spec/workers/ci/parse_secure_file_metadata_worker_spec.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require 'spec_helper' + +RSpec.describe Ci::ParseSecureFileMetadataWorker do + describe '#perform' do + include_examples 'an idempotent worker' do + let(:secure_file) { create(:ci_secure_file) } + subject { described_class.new.perform(secure_file&.id) } + + context 'when the file is found' do + it 'calls update_metadata!' do + allow(::Ci::SecureFile).to receive(:find_by_id).and_return(secure_file) + expect(secure_file).to receive(:update_metadata!) + + subject + end + end + end + + context 'when file is not found' do + let(:secure_file) { nil } + + it 'does not call update_metadata!' do + expect(secure_file).not_to receive(:update_metadata!) + + subject + end + end + end +end |