Add a controller test for the new 'diff_view' cookie
This commit is contained in:
parent
cf1349adb7
commit
f6d816f9fe
|
|
@ -26,15 +26,13 @@ class Projects::ApplicationController < ApplicationController
|
|||
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
|
||||
|
|
|
|||
|
|
@ -199,6 +199,18 @@ describe Projects::MergeRequestsController do
|
|||
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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue