summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2016-03-30 22:50:15 +0000
committerYorick Peterse <yorickpeterse@gmail.com>2016-03-30 22:50:15 +0000
commitc4ece04b690151e9762338648a428a4e04436933 (patch)
treef89573d7a372e0ed3e7c107c0b4e2ca7256fbd2f /spec
parent794674379e31a154b2b71ed492fcccdac12ffe3c (diff)
parent720ef51bd97f478dba2d2c1b59df958dabd7500a (diff)
downloadgitlab-ce-c4ece04b690151e9762338648a428a4e04436933.tar.gz
Merge branch 'check-project-repo-exists' into 'master'
Check if repo exists before attempting to update cache info See merge request !3414
Diffstat (limited to 'spec')
-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