Commit 6e83683f authored by George Thomas's avatar George Thomas

Refactor expect_paginated_array_response

This will allow for callers can pass items as multiple arguments
rather than wrapping them in an array
parent 35b18fe2
---
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