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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
69854c56
Commit
69854c56
authored
Oct 10, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4736 from karlhungus/feature-create-wiki-repo-on-repo-enabled
Create a wiki when wiki_enabled:true
parents
e8d1e827
0cd28156
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
app/observers/project_observer.rb
app/observers/project_observer.rb
+5
-0
spec/observers/users_project_observer_spec.rb
spec/observers/users_project_observer_spec.rb
+27
-1
No files found.
app/observers/project_observer.rb
View file @
69854c56
...
@@ -14,6 +14,11 @@ class ProjectObserver < BaseObserver
...
@@ -14,6 +14,11 @@ class ProjectObserver < BaseObserver
log_info
(
"
#{
project
.
owner
.
name
}
created a new project
\"
#{
project
.
name_with_namespace
}
\"
"
)
log_info
(
"
#{
project
.
owner
.
name
}
created a new project
\"
#{
project
.
name_with_namespace
}
\"
"
)
end
end
if
project
.
wiki_enabled?
# force the creation of a wiki,
GollumWiki
.
new
(
project
,
project
.
owner
).
wiki
end
end
end
def
after_update
(
project
)
def
after_update
(
project
)
...
...
spec/observers/users_project_observer_spec.rb
View file @
69854c56
...
@@ -65,4 +65,30 @@ describe UsersProjectObserver do
...
@@ -65,4 +65,30 @@ describe UsersProjectObserver do
@users_project
.
destroy
@users_project
.
destroy
end
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
end
\ No newline at end of file
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