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:
authorStan Hu <stanhu@gmail.com>2016-03-27 16:17:49 +0300
committerStan Hu <stanhu@gmail.com>2016-03-27 16:17:49 +0300
commit720ef51bd97f478dba2d2c1b59df958dabd7500a (patch)
treebde1e83469b0ccb258a55bc207b5040642840217 /spec/workers/project_cache_worker_spec.rb
parentc1834664a7a29a32551291102265ece978c55ffe (diff)
Check if repo exists before attempting to update cache info
Closes #14361
Diffstat (limited to 'spec/workers/project_cache_worker_spec.rb')
-rw-r--r--spec/workers/project_cache_worker_spec.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/spec/workers/project_cache_worker_spec.rb b/spec/workers/project_cache_worker_spec.rb
new file mode 100644
index 00000000000..7e59bd2fced
--- /dev/null
+++ b/spec/workers/project_cache_worker_spec.rb
@@ -0,0 +1,27 @@
+require 'spec_helper'
+
+describe ProjectCacheWorker do
+ let(:project) { create(:project) }
+
+ subject { described_class.new }
+
+ describe '#perform' do
+ it 'updates project cache data' do
+
+ expect_any_instance_of(Repository).to receive(:size)
+ expect_any_instance_of(Repository).to receive(:commit_count)
+
+ expect_any_instance_of(Project).to receive(:update_repository_size)
+ expect_any_instance_of(Project).to receive(:update_commit_count)
+
+ subject.perform(project.id)
+ end
+
+ it 'handles missing repository data' do
+ expect_any_instance_of(Repository).to receive(:exists?).and_return(false)
+ expect_any_instance_of(Repository).not_to receive(:size)
+
+ subject.perform(project.id)
+ end
+ end
+end