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/projects/process_sync_events_worker_spec.rb')
-rw-r--r--spec/workers/projects/process_sync_events_worker_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/workers/projects/process_sync_events_worker_spec.rb b/spec/workers/projects/process_sync_events_worker_spec.rb
new file mode 100644
index 00000000000..600fbbc6b20
--- /dev/null
+++ b/spec/workers/projects/process_sync_events_worker_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe Projects::ProcessSyncEventsWorker do
+ let!(:group) { create(:group) }
+ let!(:project) { create(:project) }
+
+ include_examples 'an idempotent worker'
+
+ describe '#perform' do
+ subject(:perform) { described_class.new.perform }
+
+ before do
+ project.update!(namespace: group)
+ end
+
+ it 'consumes all sync events' do
+ expect { perform }.to change(Projects::SyncEvent, :count).from(2).to(0)
+ end
+
+ it 'syncs project namespace id' do
+ expect { perform }.to change(Ci::ProjectMirror, :all).to contain_exactly(
+ an_object_having_attributes(namespace_id: group.id)
+ )
+ end
+ end
+end