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
def go(extra_params = {})
params = {
namespace_id: project.namespace.to_param,
project_id: project.to_param,
id: merge_request.iid
}
get :diffs, params.merge(extra_params)
end
it 'saves the preferred diff view in a cookie' do it 'saves the preferred diff view in a cookie' do
get :diffs, go view: 'parallel'
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') 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