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
Léo-Paul Géneau
gitlab-ce
Commits
461abaa8
Commit
461abaa8
authored
Oct 09, 2013
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GollumWiki#empty? method
parent
7af1bc3b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
0 deletions
+25
-0
app/models/gollum_wiki.rb
app/models/gollum_wiki.rb
+4
-0
spec/models/gollum_wiki_spec.rb
spec/models/gollum_wiki_spec.rb
+21
-0
No files found.
app/models/gollum_wiki.rb
View file @
461abaa8
...
@@ -45,6 +45,10 @@ class GollumWiki
...
@@ -45,6 +45,10 @@ class GollumWiki
end
end
end
end
def
empty?
pages
.
empty?
end
# Returns an Array of Gitlab WikiPage instances or an
# Returns an Array of Gitlab WikiPage instances or an
# empty Array if this Wiki has no pages.
# empty Array if this Wiki has no pages.
def
pages
def
pages
...
...
spec/models/gollum_wiki_spec.rb
View file @
461abaa8
...
@@ -86,6 +86,27 @@ describe GollumWiki do
...
@@ -86,6 +86,27 @@ describe GollumWiki do
end
end
end
end
describe
"#empty?"
do
context
"when the wiki repository is empty"
do
before
do
Gitlab
::
Shell
.
any_instance
.
stub
(
:add_repository
)
do
create_temp_repo
(
"
#{
Rails
.
root
}
/tmp/test-git-base-path/non-existant.wiki.git"
)
end
project
.
stub
(
:path_with_namespace
).
and_return
(
"non-existant"
)
end
its
(
:empty?
)
{
should
be_true
}
end
context
"when the wiki has pages"
do
before
do
create_page
(
"index"
,
"This is an awesome new Gollum Wiki"
)
end
its
(
:empty?
)
{
should
be_false
}
end
end
describe
"#pages"
do
describe
"#pages"
do
before
do
before
do
create_page
(
"index"
,
"This is an awesome new Gollum Wiki"
)
create_page
(
"index"
,
"This is an awesome new Gollum Wiki"
)
...
...
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