Commit 485845bf authored by Eugenia Grieff's avatar Eugenia Grieff

Replace method to ignore array result order

Use method expect_response_contain_exactly instead
of expect_paginated_array_response in specs
where the result is not expected to be ordered
parent 30b55047
......@@ -220,7 +220,7 @@ describe API::MergeRequests do
it 'returns merge requests with given assignee ID' do
get api('/merge_requests', user), params: { assignee_id: user2.id }
expect_paginated_array_response([merge_request2.id, merge_request.id])
expect_response_contain_exactly(merge_request2.id, merge_request.id)
end
end
......@@ -237,7 +237,7 @@ describe API::MergeRequests do
let(:approvers_param) { [merge_request_with_approver.approvers.first.user_id] }
it 'returns an array of merge requests which have specified the user as an approver' do
expect_paginated_array_response([merge_request_with_approver.id])
expect_response_contain_exactly(merge_request_with_approver.id)
end
end
......@@ -245,7 +245,7 @@ describe API::MergeRequests do
let(:approvers_param) { 'None' }
it 'returns an array of merge requests with no approvers' do
expect_paginated_array_response([merge_request.id])
expect_response_contain_exactly(merge_request.id)
end
end
......@@ -253,7 +253,7 @@ describe API::MergeRequests do
let(:approvers_param) { 'Any' }
it 'returns an array of merge requests with any approver' do
expect_paginated_array_response([merge_request_with_approver.id])
expect_response_contain_exactly(merge_request_with_approver.id)
end
end
......@@ -282,7 +282,7 @@ describe API::MergeRequests do
let(:approvals_param) { [user2.id] }
it 'returns an array of merge requests which have specified the user as an approver' do
expect_paginated_array_response([merge_request_with_approval.id])
expect_response_contain_exactly(merge_request_with_approval.id)
end
end
......@@ -290,7 +290,7 @@ describe API::MergeRequests do
let(:approvals_param) { 'None' }
it 'returns an array of merge requests with no approvers' do
expect_paginated_array_response([merge_request.id])
expect_response_contain_exactly(merge_request.id)
end
end
......@@ -298,7 +298,7 @@ describe API::MergeRequests do
let(:approvals_param) { 'Any' }
it 'returns an array of merge requests with any approver' do
expect_paginated_array_response([merge_request_with_approval.id])
expect_response_contain_exactly(merge_request_with_approval.id)
end
end
......
This diff is collapsed.
......@@ -58,6 +58,13 @@ module ApiHelpers
expect(json_response.map { |item| item['id'] }).to eq(Array(items))
end
def expect_response_contain_exactly(*items)
expect(response).to have_gitlab_http_status(:ok)
expect(json_response).to be_an Array
expect(json_response.length).to eq(items.size)
expect(json_response.map { |item| item['id'] }).to contain_exactly(*items)
end
def stub_last_activity_update
allow_any_instance_of(Users::ActivityService).to receive(:execute)
end
......
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