Commit 53579e0a authored by Rajendra Kadam's avatar Rajendra Kadam

Update specs json_message assertion

parent c16b9a01
...@@ -592,23 +592,21 @@ describe API::Groups do ...@@ -592,23 +592,21 @@ describe API::Groups do
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
expect(response.message).to eq('Bad Request') expect(response.message).to eq('Bad Request')
expect(json_response['message']).to eq('Failed to save group'\ expect(json_response['message']['avatar']).to eq(['file format is not supported.'\
' {:avatar=>["file format is not supported.'\
' Please try one of the following supported formats:'\ ' Please try one of the following supported formats:'\
'png, jpg, jpeg, gif, bmp, tiff, ico"]}') ' png, jpg, jpeg, gif, bmp, tiff, ico'])
end end
it 'returns 400 if file size exceeds allowed limit for group avatar' do it 'returns 400 if file size exceeds allowed limit for group avatar' do
group_param = { group_param = {
avatar: fixture_file_upload('spec/fixtures/doc_sample.txt', 'text/plain') avatar: fixture_file_upload('spec/fixtures/big-image.png', 'image/png')
} }
put api("/groups/#{group1.id}", user1), params: group_param put api("/groups/#{group1.id}", user1), params: group_param
expect(response).to have_gitlab_http_status(:bad_request) expect(response).to have_gitlab_http_status(:bad_request)
expect(response.message).to eq('Bad Request') expect(response.message).to eq('Bad Request')
expect(json_response['message']).to eq('Failed to save group'\ expect(json_response['message']['avatar']).to eq(['is too big (should be at most 200 KB)'])
' {:avatar=>["is too big (should be at most 200 KB)"]}')
end end
it 'returns 404 for a non existing group' do it 'returns 404 for a non existing group' do
...@@ -1052,7 +1050,7 @@ describe API::Groups do ...@@ -1052,7 +1050,7 @@ describe API::Groups do
expect(json_response['message']).to eq('Failed to save group'\ expect(json_response['message']).to eq('Failed to save group'\
' {:avatar=>["file format is not supported.'\ ' {:avatar=>["file format is not supported.'\
' Please try one of the following supported formats:'\ ' Please try one of the following supported formats:'\
'png, jpg, jpeg, gif, bmp, tiff, ico"]}') ' png, jpg, jpeg, gif, bmp, tiff, ico"]}')
end end
it 'returns 400 if group avatar file size exceeds allowed limit' do it 'returns 400 if group avatar file size exceeds allowed limit' 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