Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Mulvany <amulvany@gitlab.com>2019-02-15 03:16:58 +0300
committerRémy Coutable <remy@rymai.me>2019-02-21 20:29:00 +0300
commit38bbc097fabfc90344443003df030d97aee63673 (patch)
treedc4f51378a51cdafc39bab3f39be60ab529800ff /spec/serializers/pipeline_serializer_spec.rb
parentcf8c2eeba4fdf0f107aad312c09ab26eac04a29c (diff)
Properly implement API pagination headers and add specs
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'spec/serializers/pipeline_serializer_spec.rb')
-rw-r--r--spec/serializers/pipeline_serializer_spec.rb14
1 files changed, 4 insertions, 10 deletions
diff --git a/spec/serializers/pipeline_serializer_spec.rb b/spec/serializers/pipeline_serializer_spec.rb
index 79aa32b29bb..2bdcb2a45f6 100644
--- a/spec/serializers/pipeline_serializer_spec.rb
+++ b/spec/serializers/pipeline_serializer_spec.rb
@@ -38,15 +38,9 @@ describe PipelineSerializer do
end
context 'when used with pagination' do
- let(:request) { spy('request') }
+ let(:request) { double(url: "#{Gitlab.config.gitlab.url}:8080/api/v4/projects?#{query.to_query}", query_parameters: query) }
let(:response) { spy('response') }
- let(:pagination) { {} }
-
- before do
- allow(request)
- .to receive(:query_parameters)
- .and_return(pagination)
- end
+ let(:query) { {} }
let(:serializer) do
described_class.new(current_user: user)
@@ -60,7 +54,7 @@ describe PipelineSerializer do
context 'when resource is not paginatable' do
context 'when a single pipeline object is being serialized' do
let(:resource) { create(:ci_empty_pipeline) }
- let(:pagination) { { page: 1, per_page: 1 } }
+ let(:query) { { page: 1, per_page: 1 } }
it 'raises error' do
expect { subject }.to raise_error(
@@ -71,7 +65,7 @@ describe PipelineSerializer do
context 'when resource is paginatable relation' do
let(:resource) { Ci::Pipeline.all }
- let(:pagination) { { page: 1, per_page: 2 } }
+ let(:query) { { page: 1, per_page: 2 } }
context 'when a single pipeline object is present in relation' do
before do