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
iv
gitlab-ce
Commits
f6d816f9
Commit
f6d816f9
authored
Feb 05, 2016
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a controller test for the new 'diff_view' cookie
parent
cf1349ad
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
4 deletions
+14
-4
app/controllers/projects/application_controller.rb
app/controllers/projects/application_controller.rb
+1
-3
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+13
-1
No files found.
app/controllers/projects/application_controller.rb
View file @
f6d816f9
...
@@ -26,15 +26,13 @@ class Projects::ApplicationController < ApplicationController
...
@@ -26,15 +26,13 @@ class Projects::ApplicationController < ApplicationController
end
end
end
end
pr
otected
pr
ivate
def
apply_diff_view_cookie!
def
apply_diff_view_cookie!
view
=
params
[
:view
]
||
cookies
[
:diff_view
]
view
=
params
[
:view
]
||
cookies
[
:diff_view
]
cookies
.
permanent
[
:diff_view
]
=
params
[
:view
]
=
view
if
view
cookies
.
permanent
[
:diff_view
]
=
params
[
:view
]
=
view
if
view
end
end
private
def
builds_enabled
def
builds_enabled
return
render_404
unless
@project
.
builds_enabled?
return
render_404
unless
@project
.
builds_enabled?
end
end
...
...
spec/controllers/projects/merge_requests_controller_spec.rb
View file @
f6d816f9
...
@@ -188,7 +188,7 @@ describe Projects::MergeRequestsController do
...
@@ -188,7 +188,7 @@ describe Projects::MergeRequestsController do
expect
(
response
).
to
render_template
(
'diffs'
)
expect
(
response
).
to
render_template
(
'diffs'
)
end
end
end
end
context
'as json'
do
context
'as json'
do
it
'renders the diffs template to a string'
do
it
'renders the diffs template to a string'
do
go
format:
'json'
go
format:
'json'
...
@@ -199,6 +199,18 @@ describe Projects::MergeRequestsController do
...
@@ -199,6 +199,18 @@ describe Projects::MergeRequestsController do
end
end
end
end
describe
'GET diffs with view'
do
it
'saves the preferred diff view in a cookie'
do
get
:diffs
,
namespace_id:
project
.
namespace
.
to_param
,
project_id:
project
.
to_param
,
id:
merge_request
.
iid
,
view:
'parallel'
expect
(
response
.
cookies
[
'diff_view'
]).
to
eq
(
'parallel'
)
end
end
describe
'GET commits'
do
describe
'GET commits'
do
def
go
(
format:
'html'
)
def
go
(
format:
'html'
)
get
:commits
,
get
:commits
,
...
...
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