BigW Consortium Gitlab

Commit 03bed0fb by Valery Sizov

Clean up search result classes

parent ad599eb6
...@@ -28,11 +28,6 @@ module Gitlab ...@@ -28,11 +28,6 @@ module Gitlab
end end
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 def blobs_count
@blobs_count ||= blobs.count @blobs_count ||= blobs.count
end end
......
...@@ -27,11 +27,6 @@ module Gitlab ...@@ -27,11 +27,6 @@ module Gitlab
end end
end end
def total_count
@total_count ||= projects_count + issues_count + merge_requests_count +
milestones_count
end
def projects_count def projects_count
@projects_count ||= projects.count @projects_count ||= projects.count
end end
...@@ -48,10 +43,6 @@ module Gitlab ...@@ -48,10 +43,6 @@ module Gitlab
@milestones_count ||= milestones.count @milestones_count ||= milestones.count
end end
def empty?
total_count.zero?
end
private private
def projects def projects
......
...@@ -20,10 +20,6 @@ module Gitlab ...@@ -20,10 +20,6 @@ module Gitlab
end end
end end
def total_count
@total_count ||= snippet_titles_count + snippet_blobs_count
end
def snippet_titles_count def snippet_titles_count
@snippet_titles_count ||= snippet_titles.count @snippet_titles_count ||= snippet_titles.count
end end
......
...@@ -12,12 +12,6 @@ describe Gitlab::SearchResults do ...@@ -12,12 +12,6 @@ describe Gitlab::SearchResults do
let!(:milestone) { create(:milestone, project: project, title: 'foo') } let!(:milestone) { create(:milestone, project: project, title: 'foo') }
let(:results) { described_class.new(user, Project.all, '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 describe '#projects_count' do
it 'returns the total amount of projects' do it 'returns the total amount of projects' do
expect(results.projects_count).to eq(1) expect(results.projects_count).to eq(1)
...@@ -42,18 +36,6 @@ describe Gitlab::SearchResults do ...@@ -42,18 +36,6 @@ describe Gitlab::SearchResults do
end end
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 describe 'confidential issues' do
let(:project_1) { create(:empty_project) } let(:project_1) { create(:empty_project) }
let(:project_2) { create(:empty_project) } let(:project_2) { create(:empty_project) }
......
...@@ -5,12 +5,6 @@ describe Gitlab::SnippetSearchResults do ...@@ -5,12 +5,6 @@ describe Gitlab::SnippetSearchResults do
let(:results) { described_class.new(Snippet.all, 'foo') } 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 describe '#snippet_titles_count' do
it 'returns the amount of matched snippet titles' do it 'returns the amount of matched snippet titles' do
expect(results.snippet_titles_count).to eq(1) expect(results.snippet_titles_count).to eq(1)
......
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