Commit fcab4df1 authored by Changzheng Liu's avatar Changzheng Liu Committed by Dmytro Zaporozhets

Remove some spec

Update spec
parent d6a1384d
---
title: Wrap wiki blob search result in its own object
merge_request: 31155
author:
type: fixed
......@@ -18,7 +18,7 @@ module Gitlab
when 'blobs'
paginated_blobs(blobs(limit: limit_up_to_page(page, per_page)), page, per_page)
when 'wiki_blobs'
paginated_blobs(wiki_blobs(limit: limit_up_to_page(page, per_page)), page, per_page)
paginated_wiki_blobs(wiki_blobs(limit: limit_up_to_page(page, per_page)), page, per_page)
when 'commits'
Kaminari.paginate_array(commits).page(page).per(per_page)
when 'users'
......@@ -94,6 +94,13 @@ module Gitlab
results
end
def paginated_wiki_blobs(blobs, page, per_page)
blob_array = paginated_blobs(blobs, page, per_page)
blob_array.map! do |blob|
Gitlab::Search::FoundWikiPage.new(blob)
end
end
def limit_up_to_page(page, per_page)
current_page = page&.to_i || 1
offset = per_page * (current_page - 1)
......
......@@ -225,6 +225,22 @@ describe Gitlab::ProjectSearchResults do
end
it_behaves_like 'blob search pagination', 'wiki_blobs'
context 'return type' do
let(:blobs) { [Gitlab::Search::FoundBlob.new(project: project)] }
let(:results) { described_class.new(user, project, "Files", per_page: 20) }
before do
allow(results).to receive(:wiki_blobs).and_return(blobs)
end
it 'returns list of FoundWikiPage type object' do
objects = results.objects('wiki_blobs')
expect(objects).to be_present
expect(objects).to all(be_a(Gitlab::Search::FoundWikiPage))
end
end
end
it 'does not list issues on private projects' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment