Commit 8e980584 authored by Jan Provaznik's avatar Jan Provaznik

Merge branch '205569-refactor-expectations-paginated-array-response' into 'master'

Refactor expect_paginated_array_response

Closes #205569

See merge request gitlab-org/gitlab!25500
parents f09786f1 6e83683f
---
title: Refactor expected_paginated_array_response
merge_request: 25500
author: George Thomas @thegeorgeous
type: other
...@@ -51,11 +51,11 @@ module ApiHelpers ...@@ -51,11 +51,11 @@ module ApiHelpers
expect(json_response).to be_an Array expect(json_response).to be_an Array
end end
def expect_paginated_array_response(items) def expect_paginated_array_response(*items)
expect(response).to have_gitlab_http_status(:ok) expect(response).to have_gitlab_http_status(:ok)
expect(response).to include_pagination_headers expect(response).to include_pagination_headers
expect(json_response).to be_an Array expect(json_response).to be_an Array
expect(json_response.map { |item| item['id'] }).to eq(Array(items)) expect(json_response.map { |item| item['id'] }).to eq(items.flatten)
end end
def expect_response_contain_exactly(*items) def expect_response_contain_exactly(*items)
......
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