diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-18 11:52:01 +0300 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-18 11:52:01 +0300 |
commit | d7a4a2fe7577f2ca17d28f10d312ed98d5253ae4 (patch) | |
tree | 9ed2ce4dbe35a68da6f7e9fad4a42200264bca86 /spec/workers/repository_check | |
parent | 6d899f46b577190eade2db9be548dcda271a9023 (diff) |
When a project wiki is disabled skip it for fsck
Diffstat (limited to 'spec/workers/repository_check')
-rw-r--r-- | spec/workers/repository_check/single_repository_worker_spec.rb | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/workers/repository_check/single_repository_worker_spec.rb b/spec/workers/repository_check/single_repository_worker_spec.rb new file mode 100644 index 00000000000..3179dd70b0a --- /dev/null +++ b/spec/workers/repository_check/single_repository_worker_spec.rb @@ -0,0 +1,30 @@ +require 'spec_helper' +require 'fileutils' + +describe RepositoryCheck::SingleRepositoryWorker do + subject { described_class.new } + + it 'fails if the wiki repository is broken' do + project = create(:project_empty_repo, wiki_enabled: true) + project.create_wiki + + # Test sanity: everything should be fine before the wiki repo is broken + subject.perform(project.id) + expect(project.reload.last_repository_check_failed).to eq(false) + + FileUtils.rm_rf(project.wiki.repository.path_to_repo) + subject.perform(project.id) + + expect(project.reload.last_repository_check_failed).to eq(true) + end + + 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 + FileUtils.rm_rf(project.wiki.repository.path_to_repo) + + subject.perform(project.id) + + expect(project.reload.last_repository_check_failed).to eq(false) + end +end |