summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorMicaël Bergeron <mbergeron@gitlab.com>2018-02-21 16:09:53 -0500
committerMicaël Bergeron <mbergeron@gitlab.com>2018-03-01 10:36:24 -0500
commita8df653faeec9147725a391d6de49d1b9fe4528e (patch)
treedd7537bd9be2adf3280b985600c0d88784ea6967 /spec/tasks
parent0f1d348d683fdef6c36c3b244c85e59f582ff886 (diff)
downloadgitlab-ce-a8df653faeec9147725a391d6de49d1b9fe4528e.tar.gz
another round of fixes
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/uploads/migrate_rake_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/uploads/migrate_rake_spec.rb b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
new file mode 100644
index 00000000000..b778d26060d
--- /dev/null
+++ b/spec/tasks/gitlab/uploads/migrate_rake_spec.rb
@@ -0,0 +1,28 @@
+require 'rake_helper'
+
+describe 'gitlab:uploads:migrate rake tasks' do
+ let!(:projects) { create_list(:project, 10, :with_avatar) }
+ let(:model_class) { Project }
+ let(:uploader_class) { AvatarUploader }
+ let(:mounted_as) { :avatar }
+ let(:batch_size) { 3 }
+
+ before do
+ stub_env('BATCH', batch_size.to_s)
+ stub_uploads_object_storage(uploader_class)
+ Rake.application.rake_require 'tasks/gitlab/uploads/migrate'
+
+ allow(ObjectStorage::MigrateUploadsWorker).to receive(:perform_async)
+ end
+
+ def run
+ args = [uploader_class.to_s, model_class.to_s, mounted_as].compact
+ run_rake_task("gitlab:uploads:migrate", *args)
+ end
+
+ it 'enqueue jobs in batch' do
+ expect(ObjectStorage::MigrateUploadsWorker).to receive(:enqueue!).exactly(4).times
+
+ run
+ end
+end