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
b8c9ad52
Commit
b8c9ad52
authored
Apr 15, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add specs for nil page content
parent
6df27e86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
app/controllers/projects/wikis_controller.rb
app/controllers/projects/wikis_controller.rb
+5
-1
spec/controllers/projects/wikis_controller_spec.rb
spec/controllers/projects/wikis_controller_spec.rb
+19
-2
No files found.
app/controllers/projects/wikis_controller.rb
View file @
b8c9ad52
...
...
@@ -167,7 +167,11 @@ class Projects::WikisController < Projects::ApplicationController
end
def
load_page
@page
||=
@project_wiki
.
find_page
(
*
page_params
)
@page
||=
find_page
end
def
find_page
@project_wiki
.
find_page
(
*
page_params
)
end
def
page_params
...
...
spec/controllers/projects/wikis_controller_spec.rb
View file @
b8c9ad52
...
...
@@ -200,7 +200,20 @@ describe Projects::WikisController do
subject
expect
(
response
).
to
redirect_to
(
project_wiki_path
(
project
,
project_wiki
.
list_pages
.
first
))
expect
(
response
).
to
redirect_to_wiki
(
project
,
project_wiki
.
list_pages
.
first
)
end
end
context
'when the page has nil content'
do
let
(
:page
)
{
create
(
:wiki_page
)
}
it
'redirects to show'
do
allow
(
page
).
to
receive
(
:content
).
and_return
(
nil
)
allow
(
controller
).
to
receive
(
:find_page
).
and_return
(
page
)
subject
expect
(
response
).
to
redirect_to_wiki
(
project
,
page
)
end
end
...
...
@@ -235,7 +248,7 @@ describe Projects::WikisController do
allow
(
controller
).
to
receive
(
:valid_encoding?
).
and_return
(
false
)
subject
expect
(
response
).
to
redirect_to
(
project_wiki_path
(
project
,
project_wiki
.
list_pages
.
first
)
)
expect
(
response
).
to
redirect_to
_wiki
(
project
,
project_wiki
.
list_pages
.
first
)
end
end
...
...
@@ -265,4 +278,8 @@ describe Projects::WikisController do
page
=
wiki
.
page
(
title:
title
,
dir:
dir
)
project_wiki
.
delete_page
(
page
,
"test commit"
)
end
def
redirect_to_wiki
(
project
,
page
)
redirect_to
(
controller
.
project_wiki_path
(
project
,
page
))
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