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/group_import_worker_spec.rb')
-rw-r--r--spec/workers/group_import_worker_spec.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/spec/workers/group_import_worker_spec.rb b/spec/workers/group_import_worker_spec.rb
index bb7dc116a08..324a5fa6978 100644
--- a/spec/workers/group_import_worker_spec.rb
+++ b/spec/workers/group_import_worker_spec.rb
@@ -26,7 +26,7 @@ describe GroupImportWorker do
subject.perform(user.id, group.id)
end
- context 'import state' do
+ context 'when the import state does not exist' do
it 'creates group import' do
expect(group.import_state).to be_nil
@@ -54,6 +54,17 @@ describe GroupImportWorker do
subject.perform(user.id, group.id)
end
end
+
+ context 'when the import state already exists' do
+ it 'updates the existing state' do
+ existing_state = create(:group_import_state, group: group)
+
+ expect { subject.perform(user.id, group.id) }
+ .not_to change { GroupImportState.count }
+
+ expect(existing_state.reload).to be_finished
+ end
+ end
end
context 'when it fails' do