Commit 9d5bb5a7 authored by Izaak Alpert's avatar Izaak Alpert

Brings this fix inline with updates to master

Change-Id: Ia50c3ac043b4c927ca59cbbdc2bba42f73e550e4
parent af1a3391
......@@ -46,15 +46,6 @@ module Projects
@project.creator = current_user
if @project.valid? && @project.wiki_enabled?
begin
#force the creation of a wiki,
GollumWiki.new(@project, current_user).wiki
rescue => exception
@project.errors.add(:wiki_enabled, 'cannot create wiki')
end
end
if @project.save
@project.discover_default_branch
......
......@@ -14,6 +14,12 @@ 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,27 @@ describe UsersProjectObserver do
@users_project.destroy
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
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