Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/workers/ci/parse_secure_file_metadata_worker_spec.rb')
-rw-r--r--spec/workers/ci/parse_secure_file_metadata_worker_spec.rb31
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