diff options
author | Markus Koller <mkoller@gitlab.com> | 2019-09-03 19:45:00 +0200 |
---|---|---|
committer | Markus Koller <mkoller@gitlab.com> | 2019-09-10 15:24:29 +0200 |
commit | f1926b321deb8b922dead991fb4d8bea42699f9f (patch) | |
tree | 7dfb7b613152cc6282b1f169e781f11f736de36a /spec/controllers/dashboard/snippets_controller_spec.rb | |
parent | 60755fbc406bd25ab526339899f97a2b27aeb272 (diff) | |
download | gitlab-ce-65988-optimize-snippet-listings.tar.gz |
Add controller concern for paginated collections65988-optimize-snippet-listings
We had similar code in a few places to redirect to the last page if
the given page number is out of range. This unifies the handling in a
new controller concern and adds usage of it in all snippet listings.
Diffstat (limited to 'spec/controllers/dashboard/snippets_controller_spec.rb')
-rw-r--r-- | spec/controllers/dashboard/snippets_controller_spec.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/controllers/dashboard/snippets_controller_spec.rb b/spec/controllers/dashboard/snippets_controller_spec.rb new file mode 100644 index 00000000000..2d839094d34 --- /dev/null +++ b/spec/controllers/dashboard/snippets_controller_spec.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe Dashboard::SnippetsController do + let(:user) { create(:user) } + + before do + sign_in(user) + end + + describe 'GET #index' do + it_behaves_like 'paginated collection' do + let(:collection) { Snippet.all } + + before do + create(:personal_snippet, :public, author: user) + end + end + end +end |