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
741e0b23
Commit
741e0b23
authored
Mar 15, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE-only elasticsearch specs in ee/spec/helpers/search_helper_spec.rb
parent
c174fadc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
33 deletions
+36
-33
ee/spec/helpers/search_helper_spec.rb
ee/spec/helpers/search_helper_spec.rb
+36
-0
spec/helpers/search_helper_spec.rb
spec/helpers/search_helper_spec.rb
+0
-33
No files found.
ee/spec/helpers/search_helper_spec.rb
0 → 100644
View file @
741e0b23
require
'spec_helper'
describe
SearchHelper
do
describe
'#parse_search_result_from_elastic'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
it
"returns parsed result"
do
project
=
create
:project
,
:repository
project
.
repository
.
index_blobs
Gitlab
::
Elastic
::
Helper
.
refresh_index
result
=
project
.
repository
.
search
(
'def popen'
,
type: :blob
,
options:
{
highlight:
true
}
)[
:blobs
][
:results
][
0
]
parsed_result
=
helper
.
parse_search_result
(
result
)
expect
(
parsed_result
.
ref
).
to
eq
(
'b83d6e391c22777fca1ed3012fce84f633d7fed0'
)
expect
(
parsed_result
.
filename
).
to
eq
(
'files/ruby/popen.rb'
)
expect
(
parsed_result
.
startline
).
to
eq
(
2
)
expect
(
parsed_result
.
data
).
to
include
(
"Popen"
)
end
end
end
spec/helpers/search_helper_spec.rb
View file @
741e0b23
...
...
@@ -6,39 +6,6 @@ describe SearchHelper do
str
end
describe
'#parse_search_result_from_elastic'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
stub_ee_application_setting
(
elasticsearch_search:
false
,
elasticsearch_indexing:
false
)
end
it
"returns parsed result"
do
project
=
create
:project
,
:repository
project
.
repository
.
index_blobs
Gitlab
::
Elastic
::
Helper
.
refresh_index
result
=
project
.
repository
.
search
(
'def popen'
,
type: :blob
,
options:
{
highlight:
true
}
)[
:blobs
][
:results
][
0
]
parsed_result
=
helper
.
parse_search_result
(
result
)
expect
(
parsed_result
.
ref
).
to
eq
(
'b83d6e391c22777fca1ed3012fce84f633d7fed0'
)
expect
(
parsed_result
.
filename
).
to
eq
(
'files/ruby/popen.rb'
)
expect
(
parsed_result
.
startline
).
to
eq
(
2
)
expect
(
parsed_result
.
data
).
to
include
(
"Popen"
)
end
end
describe
'search_autocomplete_source'
do
context
"with no current user"
do
before
do
...
...
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