Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
03bed0fb
Commit
03bed0fb
authored
Sep 06, 2016
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up search result classes
parent
ad599eb6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
42 deletions
+0
-42
lib/gitlab/project_search_results.rb
lib/gitlab/project_search_results.rb
+0
-5
lib/gitlab/search_results.rb
lib/gitlab/search_results.rb
+0
-9
lib/gitlab/snippet_search_results.rb
lib/gitlab/snippet_search_results.rb
+0
-4
spec/lib/gitlab/search_results_spec.rb
spec/lib/gitlab/search_results_spec.rb
+0
-18
spec/lib/gitlab/snippet_search_results_spec.rb
spec/lib/gitlab/snippet_search_results_spec.rb
+0
-6
No files found.
lib/gitlab/project_search_results.rb
View file @
03bed0fb
...
@@ -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
...
...
lib/gitlab/search_results.rb
View file @
03bed0fb
...
@@ -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
...
...
lib/gitlab/snippet_search_results.rb
View file @
03bed0fb
...
@@ -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
...
...
spec/lib/gitlab/search_results_spec.rb
View file @
03bed0fb
...
@@ -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
)
}
...
...
spec/lib/gitlab/snippet_search_results_spec.rb
View file @
03bed0fb
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment