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
c43e0cf7
Commit
c43e0cf7
authored
Mar 15, 2018
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move EE-only elasticsearch specs in spec/services/search/group_service_spec.rb
parent
741e0b23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
21 deletions
+57
-21
ee/spec/services/search/group_service_spec.rb
ee/spec/services/search/group_service_spec.rb
+57
-0
spec/services/search/group_service_spec.rb
spec/services/search/group_service_spec.rb
+0
-21
No files found.
ee/spec/services/search/group_service_spec.rb
0 → 100644
View file @
c43e0cf7
require
'spec_helper'
describe
Search
::
GroupService
do
shared_examples_for
'group search'
do
context
'finding projects by name'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:term
)
{
"Project Name"
}
let
(
:nested_group
)
{
create
(
:group
,
:nested
)
}
# These projects shouldn't be found
let!
(
:outside_project
)
{
create
(
:project
,
:public
,
name:
"Outside
#{
term
}
"
)
}
let!
(
:private_project
)
{
create
(
:project
,
:private
,
namespace:
nested_group
,
name:
"Private
#{
term
}
"
)}
let!
(
:other_project
)
{
create
(
:project
,
:public
,
namespace:
nested_group
,
name:
term
.
reverse
)
}
# These projects should be found
let!
(
:project1
)
{
create
(
:project
,
:internal
,
namespace:
nested_group
,
name:
"Inner
#{
term
}
1"
)
}
let!
(
:project2
)
{
create
(
:project
,
:internal
,
namespace:
nested_group
,
name:
"Inner
#{
term
}
2"
)
}
let!
(
:project3
)
{
create
(
:project
,
:internal
,
namespace:
nested_group
.
parent
,
name:
"Outer
#{
term
}
"
)
}
let
(
:results
)
{
described_class
.
new
(
user
,
search_group
,
search:
term
).
execute
}
subject
{
results
.
objects
(
'projects'
)
}
context
'in parent group'
do
let
(
:search_group
)
{
nested_group
.
parent
}
it
{
is_expected
.
to
match_array
([
project1
,
project2
,
project3
])
}
end
context
'in subgroup'
do
let
(
:search_group
)
{
nested_group
}
it
{
is_expected
.
to
match_array
([
project1
,
project2
])
}
end
end
end
describe
'elasticsearch'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
# Ensure these are present when the index is refreshed
_
=
[
outside_project
,
private_project
,
other_project
,
project1
,
project2
,
project3
]
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
end
include_examples
'group search'
end
end
spec/services/search/group_service_spec.rb
View file @
c43e0cf7
...
...
@@ -37,25 +37,4 @@ describe Search::GroupService do
describe
'basic search'
do
include_examples
'group search'
end
describe
'elasticsearch'
do
before
do
stub_ee_application_setting
(
elasticsearch_search:
true
,
elasticsearch_indexing:
true
)
Gitlab
::
Elastic
::
Helper
.
create_empty_index
# Ensure these are present when the index is refreshed
_
=
[
outside_project
,
private_project
,
other_project
,
project1
,
project2
,
project3
]
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
after
do
Gitlab
::
Elastic
::
Helper
.
delete_index
end
include_examples
'group search'
end
end
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