summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorYorick Peterse <yorickpeterse@gmail.com>2017-08-10 15:01:38 +0200
committerYorick Peterse <yorickpeterse@gmail.com>2017-08-14 13:53:42 +0200
commitc1f9403e45e636651010929b6113add34f8e6a8a (patch)
tree1f4dba647c4de1f43b01082c71fd70884c7ec54e /spec
parent21a6898b10ed75f6260e72467b9e1f839d48456c (diff)
downloadgitlab-ce-c1f9403e45e636651010929b6113add34f8e6a8a.tar.gz
Use Prev/Next pagination for exploring projectspagination-projects-explore
This changes the pagination of the "Explore" pages so they use a simpler pagination system that only shows "Prev" and "Next" buttons. This removes the need for getting the total number of rows to display, a process that can easily take up to 2 seconds when browsing through a large list of projects. Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/27390
Diffstat (limited to 'spec')
-rw-r--r--spec/helpers/pagination_helper_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/helpers/pagination_helper_spec.rb b/spec/helpers/pagination_helper_spec.rb
new file mode 100644
index 00000000000..e235475fb47
--- /dev/null
+++ b/spec/helpers/pagination_helper_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe PaginationHelper do
+ describe '#paginate_collection' do
+ let(:collection) { User.all.page(1) }
+
+ it 'paginates a collection without using a COUNT' do
+ without_count = collection.without_count
+
+ expect(helper).to receive(:paginate_without_count)
+ .with(without_count)
+ .and_call_original
+
+ helper.paginate_collection(without_count)
+ end
+
+ it 'paginates a collection using a COUNT' do
+ expect(helper).to receive(:paginate_with_count).and_call_original
+
+ helper.paginate_collection(collection)
+ end
+ end
+end