Commit 69854c56 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge pull request #4736 from karlhungus/feature-create-wiki-repo-on-repo-enabled

Create a wiki when wiki_enabled:true
parents e8d1e827 0cd28156
......@@ -14,6 +14,11 @@ class ProjectObserver < BaseObserver
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
end
if project.wiki_enabled?
# force the creation of a wiki,
GollumWiki.new(project, project.owner).wiki
end
end
def after_update(project)
......
......@@ -65,4 +65,30 @@ describe UsersProjectObserver do
@users_project.destroy
end
end
end
describe "#after_create" do
context 'wiki_enabled creates repository directory' do
context 'wiki_enabled true creates wiki repository directory' do
before do
@project = create(:project, wiki_enabled: true)
@path = GollumWiki.new(@project, user).send(:path_to_repo)
end
after do
FileUtils.rm_rf(@path)
end
it { File.exists?(@path).should be_true }
end
context 'wiki_enabled false does not create wiki repository directory' do
before do
@project = create(:project, wiki_enabled: false)
@path = GollumWiki.new(@project, user).send(:path_to_repo)
end
it { File.exists?(@path).should be_false }
end
end
end
end
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment