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/object_pool/join_worker_spec.rb')
-rw-r--r--spec/workers/object_pool/join_worker_spec.rb35
1 files changed, 35 insertions, 0 deletions
diff --git a/spec/workers/object_pool/join_worker_spec.rb b/spec/workers/object_pool/join_worker_spec.rb
new file mode 100644
index 00000000000..906bc22c8d2
--- /dev/null
+++ b/spec/workers/object_pool/join_worker_spec.rb
@@ -0,0 +1,35 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+describe ObjectPool::JoinWorker do
+ let(:pool) { create(:pool_repository, :ready) }
+ let(:project) { pool.source_project }
+ let(:repository) { project.repository }
+
+ subject { described_class.new }
+
+ describe '#perform' do
+ context "when the pool is not joinable" do
+ let(:pool) { create(:pool_repository, :scheduled) }
+
+ it "doesn't raise an error" do
+ expect do
+ subject.perform(pool.id, project.id)
+ end.not_to raise_error
+ end
+ end
+
+ context 'when the pool has been joined before' do
+ before do
+ pool.link_repository(repository)
+ end
+
+ it 'succeeds in joining' do
+ expect do
+ subject.perform(pool.id, project.id)
+ end.not_to raise_error
+ end
+ end
+ end
+end