Commit 551ce0f2 authored by Robert Speicher's avatar Robert Speicher

Add spec for assigning view param from cookie

parent 24f048be
...@@ -200,15 +200,29 @@ describe Projects::MergeRequestsController do ...@@ -200,15 +200,29 @@ describe Projects::MergeRequestsController do
end end
describe 'GET diffs with view' do describe 'GET diffs with view' do
it 'saves the preferred diff view in a cookie' do def go(extra_params = {})
get :diffs, params = {
namespace_id: project.namespace.to_param, namespace_id: project.namespace.to_param,
project_id: project.to_param, project_id: project.to_param,
id: merge_request.iid, id: merge_request.iid
view: 'parallel' }
get :diffs, params.merge(extra_params)
end
it 'saves the preferred diff view in a cookie' do
go view: 'parallel'
expect(response.cookies['diff_view']).to eq('parallel') expect(response.cookies['diff_view']).to eq('parallel')
end end
it 'assigns :view param based on cookie' do
request.cookies['diff_view'] = 'parallel'
go
expect(controller.params[:view]).to eq 'parallel'
end
end end
describe 'GET commits' do describe 'GET commits' do
......
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