Add spec for assigning view param from cookie
This commit is contained in:
parent
24f048be72
commit
551ce0f245
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue