diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-26 00:09:23 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-26 00:09:23 +0300 |
commit | 32fd4cd5e2134511936899d6bcc4aaf18b9be6fd (patch) | |
tree | 10378ceffed52dd0e160a0d9bcf3c5ab72c18958 /spec/controllers | |
parent | 951616a26a61e880860ad862c1d45a8e3762b4bc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/controllers')
-rw-r--r-- | spec/controllers/explore/snippets_controller_spec.rb | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/spec/controllers/explore/snippets_controller_spec.rb b/spec/controllers/explore/snippets_controller_spec.rb index fa659c6df7f..ab91faa6cef 100644 --- a/spec/controllers/explore/snippets_controller_spec.rb +++ b/spec/controllers/explore/snippets_controller_spec.rb @@ -4,12 +4,33 @@ require 'spec_helper' describe Explore::SnippetsController do describe 'GET #index' do - it_behaves_like 'paginated collection' do - let(:collection) { Snippet.all } + let!(:project_snippet) { create_list(:project_snippet, 3, :public) } + let!(:personal_snippet) { create_list(:personal_snippet, 3, :public) } - before do - create(:personal_snippet, :public) - end + before do + allow(Kaminari.config).to receive(:default_per_page).and_return(2) + end + + it 'renders' do + get :index + + snippets = assigns(:snippets) + + expect(snippets).to be_a(::Kaminari::PaginatableWithoutCount) + expect(snippets.size).to eq(2) + expect(snippets).to all(be_a(PersonalSnippet)) + expect(response).to have_gitlab_http_status(:ok) + end + + it 'renders pagination' do + get :index, params: { page: 2 } + + snippets = assigns(:snippets) + + expect(snippets).to be_a(::Kaminari::PaginatableWithoutCount) + expect(snippets.size).to eq(1) + expect(assigns(:snippets)).to all(be_a(PersonalSnippet)) + expect(response).to have_gitlab_http_status(:ok) end end end |