Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
9d5bb5a7
Commit
9d5bb5a7
authored
Sep 10, 2013
by
Izaak Alpert
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Brings this fix inline with updates to master
Change-Id: Ia50c3ac043b4c927ca59cbbdc2bba42f73e550e4
parent
af1a3391
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
9 deletions
+29
-9
app/contexts/projects/create_context.rb
app/contexts/projects/create_context.rb
+0
-9
app/observers/project_observer.rb
app/observers/project_observer.rb
+6
-0
spec/observers/users_project_observer_spec.rb
spec/observers/users_project_observer_spec.rb
+23
-0
No files found.
app/contexts/projects/create_context.rb
View file @
9d5bb5a7
...
...
@@ -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
...
...
app/observers/project_observer.rb
View file @
9d5bb5a7
...
...
@@ -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
)
...
...
spec/observers/users_project_observer_spec.rb
View file @
9d5bb5a7
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment