summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorBob Van Landuyt <bob@vanlanduyt.co>2017-09-05 17:27:55 +0200
committerBob Van Landuyt <bob@vanlanduyt.co>2017-10-04 22:46:49 +0200
commit28c440045ed001ab6029131ab7c842b390f4e186 (patch)
tree034a2d3c44e35373b3fb338d37447b16e0f9fef9 /spec/controllers
parent80780018a931ce41047ab62ed7dd6c5f1e28f08b (diff)
downloadgitlab-ce-28c440045ed001ab6029131ab7c842b390f4e186.tar.gz
Add pagination for children
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/groups_controller_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb
index c96a44d6186..9b4654dc3e4 100644
--- a/spec/controllers/groups_controller_spec.rb
+++ b/spec/controllers/groups_controller_spec.rb
@@ -466,6 +466,24 @@ describe GroupsController do
end
end
end
+
+ context 'pagination' do
+ let!(:other_subgroup) { create(:group, :public, parent: group) }
+ let!(:project) { create(:project, :public, namespace: group) }
+ let!(:first_page_subgroups) { create_list(:group, Kaminari.config.default_per_page, parent: group) }
+
+ it 'contains all subgroups' do
+ get :children, id: group.to_param, sort: 'id', format: :json
+
+ expect(assigns(:children)).to contain_exactly(*first_page_subgroups)
+ end
+
+ it 'contains the project and group on the second page' do
+ get :children, id: group.to_param, sort: 'id', page: 2, format: :json
+
+ expect(assigns(:children)).to contain_exactly(other_subgroup, project)
+ end
+ end
end
context 'for a POST request' do