Clean up search result classes

This commit is contained in:
Valery Sizov 2016-09-06 10:12:55 +03:00
parent ad599eb65c
commit 03bed0fbd3
5 changed files with 0 additions and 42 deletions

View file

@ -28,11 +28,6 @@ module Gitlab
end
end
def total_count
@total_count ||= issues_count + merge_requests_count + blobs_count +
notes_count + wiki_blobs_count + commits_count
end
def blobs_count
@blobs_count ||= blobs.count
end

View file

@ -27,11 +27,6 @@ module Gitlab
end
end
def total_count
@total_count ||= projects_count + issues_count + merge_requests_count +
milestones_count
end
def projects_count
@projects_count ||= projects.count
end
@ -48,10 +43,6 @@ module Gitlab
@milestones_count ||= milestones.count
end
def empty?
total_count.zero?
end
private
def projects

View file

@ -20,10 +20,6 @@ module Gitlab
end
end
def total_count
@total_count ||= snippet_titles_count + snippet_blobs_count
end
def snippet_titles_count
@snippet_titles_count ||= snippet_titles.count
end

View file

@ -12,12 +12,6 @@ describe Gitlab::SearchResults do
let!(:milestone) { create(:milestone, project: project, title: 'foo') }
let(:results) { described_class.new(user, Project.all, 'foo') }
describe '#total_count' do
it 'returns the total amount of search hits' do
expect(results.total_count).to eq(4)
end
end
describe '#projects_count' do
it 'returns the total amount of projects' do
expect(results.projects_count).to eq(1)
@ -42,18 +36,6 @@ describe Gitlab::SearchResults do
end
end
describe '#empty?' do
it 'returns true when there are no search results' do
allow(results).to receive(:total_count).and_return(0)
expect(results.empty?).to eq(true)
end
it 'returns false when there are search results' do
expect(results.empty?).to eq(false)
end
end
describe 'confidential issues' do
let(:project_1) { create(:empty_project) }
let(:project_2) { create(:empty_project) }

View file

@ -5,12 +5,6 @@ describe Gitlab::SnippetSearchResults do
let(:results) { described_class.new(Snippet.all, 'foo') }
describe '#total_count' do
it 'returns the total amount of search hits' do
expect(results.total_count).to eq(2)
end
end
describe '#snippet_titles_count' do
it 'returns the amount of matched snippet titles' do
expect(results.snippet_titles_count).to eq(1)