Commit f6d816f9 authored by Rémy Coutable's avatar Rémy Coutable

Add a controller test for the new 'diff_view' cookie

parent cf1349ad
......@@ -26,15 +26,13 @@ def require_branch_head
end
end
protected
private
def apply_diff_view_cookie!
view = params[:view] || cookies[:diff_view]
cookies.permanent[:diff_view] = params[:view] = view if view
end
private
def builds_enabled
return render_404 unless @project.builds_enabled?
end
......
......@@ -188,7 +188,7 @@ def go(format: 'html')
expect(response).to render_template('diffs')
end
end
context 'as json' do
it 'renders the diffs template to a string' do
go format: 'json'
......@@ -199,6 +199,18 @@ def go(format: 'html')
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
def go(format: 'html')
get :commits,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment