summaryrefslogtreecommitdiff
path: root/spec/workers/repository_fork_worker_spec.rb
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-09-01 00:56:40 -0700
committerStan Hu <stanhu@gmail.com>2015-09-11 00:34:04 -0700
commit9995f0806b29934cf498607f59d2c5ec358a0d5a (patch)
treead197f6e023553b20bb1317c57dddffe34da68b5 /spec/workers/repository_fork_worker_spec.rb
parenta5bb85f8a234b2d8463656877712faf10f5bb842 (diff)
downloadgitlab-ce-9995f0806b29934cf498607f59d2c5ec358a0d5a.tar.gz
Import forked repositories asynchronously to prevent large repositories from timing out
Use import_status to track async import status and give feedback to the user Closes #2388 Closes #2400
Diffstat (limited to 'spec/workers/repository_fork_worker_spec.rb')
-rw-r--r--spec/workers/repository_fork_worker_spec.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/spec/workers/repository_fork_worker_spec.rb b/spec/workers/repository_fork_worker_spec.rb
new file mode 100644
index 00000000000..aa031106968
--- /dev/null
+++ b/spec/workers/repository_fork_worker_spec.rb
@@ -0,0 +1,29 @@
+require 'spec_helper'
+
+describe RepositoryForkWorker do
+ let(:project) { create(:project) }
+ let(:fork_project) { create(:project, forked_from_project: project) }
+
+ subject { RepositoryForkWorker.new }
+
+ describe "#perform" do
+ it "creates a new repository from a fork" do
+ expect_any_instance_of(Gitlab::Shell).to receive(:fork_repository).with(
+ project.path_with_namespace,
+ fork_project.namespace.path).
+ and_return(true)
+ expect(ProjectCacheWorker).to receive(:perform_async)
+
+ subject.perform(project.id,
+ project.path_with_namespace,
+ fork_project.namespace.path)
+ end
+
+ it "handles bad fork" do
+ expect_any_instance_of(Gitlab::Shell).to receive(:fork_repository).and_return(false)
+ subject.perform(project.id,
+ project.path_with_namespace,
+ fork_project.namespace.path)
+ end
+ end
+end