diff options
author | Rémy Coutable <remy@rymai.me> | 2016-01-14 14:08:44 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-01-14 14:10:27 +0300 |
commit | 3183092ca94b14d6e61f5e8ba51069554646baf8 (patch) | |
tree | 05e7d558cbf946710db76f1597e05e1ff9100904 /spec/support | |
parent | 9f8c38bdac3d6f532b50ecab1d769652ffb5acc3 (diff) |
Add pagination headers to already paginated API resources
Diffstat (limited to 'spec/support')
-rw-r--r-- | spec/support/api/pagination_shared_examples.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/support/api/pagination_shared_examples.rb b/spec/support/api/pagination_shared_examples.rb new file mode 100644 index 00000000000..352a6eeec79 --- /dev/null +++ b/spec/support/api/pagination_shared_examples.rb @@ -0,0 +1,20 @@ +# Specs for paginated resources. +# +# Requires an API request: +# let(:request) { get api("/projects/#{project.id}/repository/branches", user) } +shared_examples 'a paginated resources' do + before do + # Fires the request + request + end + + it 'has pagination headers' do + expect(response.headers).to include('X-Total') + expect(response.headers).to include('X-Total-Pages') + expect(response.headers).to include('X-Per-Page') + expect(response.headers).to include('X-Page') + expect(response.headers).to include('X-Next-Page') + expect(response.headers).to include('X-Prev-Page') + expect(response.headers).to include('Link') + end +end |