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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
84b5c942
Commit
84b5c942
authored
Feb 12, 2021
by
Francisco Javier López
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid creating repository when calling Wiki#empty?
parent
057b01c1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
1 deletion
+10
-1
app/models/wiki.rb
app/models/wiki.rb
+1
-1
spec/support/shared_examples/models/wiki_shared_examples.rb
spec/support/shared_examples/models/wiki_shared_examples.rb
+9
-0
No files found.
app/models/wiki.rb
View file @
84b5c942
...
@@ -104,7 +104,7 @@ class Wiki
...
@@ -104,7 +104,7 @@ class Wiki
end
end
def
empty?
def
empty?
list_pages
(
limit:
1
).
empty?
!
repository_exists?
||
list_pages
(
limit:
1
).
empty?
end
end
def
exists?
def
exists?
...
...
spec/support/shared_examples/models/wiki_shared_examples.rb
View file @
84b5c942
...
@@ -154,6 +154,15 @@ RSpec.shared_examples 'wiki model' do
...
@@ -154,6 +154,15 @@ RSpec.shared_examples 'wiki model' do
it
'returns true'
do
it
'returns true'
do
expect
(
subject
.
empty?
).
to
be
(
true
)
expect
(
subject
.
empty?
).
to
be
(
true
)
end
end
context
'when the repository does not exist'
do
let
(
:wiki_container
)
{
wiki_container_without_repo
}
it
'returns true and does not create the repo'
do
expect
(
subject
.
empty?
).
to
be
(
true
)
expect
(
wiki
.
repository_exists?
).
to
be
false
end
end
end
end
context
'when the wiki has pages'
do
context
'when the wiki has pages'
do
...
...
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