Combine API request spec assertions (#31970)
This commit is contained in:
parent
1fce55cf5d
commit
b071e618e7
21 changed files with 36 additions and 232 deletions
|
@ -24,30 +24,20 @@ RSpec.describe 'Favourites' do
|
|||
|
||||
it_behaves_like 'forbidden for wrong scope', 'write'
|
||||
|
||||
it 'returns http success' do
|
||||
it 'returns http success and includes the favourites' do
|
||||
subject
|
||||
|
||||
expect(response).to have_http_status(200)
|
||||
end
|
||||
|
||||
it 'returns the favourites' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body).to match_array(expected_response)
|
||||
end
|
||||
|
||||
context 'with limit param' do
|
||||
let(:params) { { limit: 1 } }
|
||||
|
||||
it 'returns only the requested number of favourites' do
|
||||
it 'returns only the requested number of favourites and sets pagination headers' do
|
||||
subject
|
||||
|
||||
expect(response.parsed_body.size).to eq(params[:limit])
|
||||
end
|
||||
|
||||
it 'sets the correct pagination headers' do
|
||||
subject
|
||||
|
||||
expect(response)
|
||||
.to include_pagination_headers(
|
||||
prev: api_v1_favourites_url(limit: params[:limit], min_id: favourites.last.id),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue