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:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-26 17:56:14 +0300
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-26 17:56:14 +0300
commit9f85b7bc58485831a61da0f9acc530511ea7474a (patch)
tree81a9c3345f46415fe44b4ab3e2b3b109d1e4259e /spec/workers/repository_check
parentf127edd012bd8b6f76ac67d69aadbd7d4837258f (diff)
Initialize wikis on legacy projects during check
Diffstat (limited to 'spec/workers/repository_check')
-rw-r--r--spec/workers/repository_check/single_repository_worker_spec.rb33
1 files changed, 28 insertions, 5 deletions
diff --git a/spec/workers/repository_check/single_repository_worker_spec.rb b/spec/workers/repository_check/single_repository_worker_spec.rb
index 087e4c667d8..5a03bb77ebd 100644
--- a/spec/workers/repository_check/single_repository_worker_spec.rb
+++ b/spec/workers/repository_check/single_repository_worker_spec.rb
@@ -12,7 +12,7 @@ describe RepositoryCheck::SingleRepositoryWorker do
subject.perform(project.id)
expect(project.reload.last_repository_check_failed).to eq(false)
- destroy_wiki(project)
+ break_wiki(project)
subject.perform(project.id)
expect(project.reload.last_repository_check_failed).to eq(true)
@@ -20,15 +20,38 @@ describe RepositoryCheck::SingleRepositoryWorker do
it 'skips wikis when disabled' do
project = create(:project_empty_repo, wiki_enabled: false)
- # Make sure the test would fail if it checked the wiki repo
- destroy_wiki(project)
+ # Make sure the test would fail if the wiki repo was checked
+ break_wiki(project)
subject.perform(project.id)
expect(project.reload.last_repository_check_failed).to eq(false)
end
- def destroy_wiki(project)
- FileUtils.rm_rf(project.wiki.repository.path_to_repo)
+ it 'creates missing wikis' do
+ project = create(:project_empty_repo, wiki_enabled: true)
+ FileUtils.rm_rf(wiki_path(project))
+
+ subject.perform(project.id)
+
+ expect(project.reload.last_repository_check_failed).to eq(false)
+ end
+
+ it 'does not create a wiki if the main repo does not exist at all' do
+ project = create(:project_empty_repo)
+ FileUtils.rm_rf(project.repository.path_to_repo)
+ FileUtils.rm_rf(wiki_path(project))
+
+ subject.perform(project.id)
+
+ expect(File.exist?(wiki_path(project))).to eq(false)
+ end
+
+ def break_wiki(project)
+ FileUtils.rm_rf(wiki_path(project) + '/objects')
+ end
+
+ def wiki_path(project)
+ project.wiki.repository.path_to_repo
end
end