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
bd195043
Commit
bd195043
authored
Feb 10, 2021
by
Dmitry Gruzd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize factory usage in search specs
parent
0015e540
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
11 deletions
+13
-11
ee/spec/lib/gitlab/elastic/search_results_spec.rb
ee/spec/lib/gitlab/elastic/search_results_spec.rb
+5
-4
ee/spec/services/search/global_service_spec.rb
ee/spec/services/search/global_service_spec.rb
+1
-1
ee/spec/services/search/group_service_spec.rb
ee/spec/services/search/group_service_spec.rb
+2
-1
ee/spec/services/search/project_service_spec.rb
ee/spec/services/search/project_service_spec.rb
+2
-2
spec/services/search/global_service_spec.rb
spec/services/search/global_service_spec.rb
+1
-1
spec/services/search/group_service_spec.rb
spec/services/search/group_service_spec.rb
+2
-2
No files found.
ee/spec/lib/gitlab/elastic/search_results_spec.rb
View file @
bd195043
...
...
@@ -300,23 +300,24 @@ RSpec.describe Gitlab::Elastic::SearchResults, :elastic, :sidekiq_might_not_need
end
context
'ordering'
do
let
!
(
:project
)
{
create
(
:project
,
:public
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
let!
(
:very_old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted very old'
,
created_at:
1
.
year
.
ago
)
}
let
(
:results_created
)
{
described_class
.
new
(
user
,
'sorted'
,
[
project
.
id
],
sort:
sort
)
}
let!
(
:old_updated
)
{
create
(
:issue
,
project:
project
,
title:
'updated old'
,
updated_at:
1
.
month
.
ago
)
}
let!
(
:new_updated
)
{
create
(
:issue
,
project:
project
,
title:
'updated recent'
,
updated_at:
1
.
day
.
ago
)
}
let!
(
:very_old_updated
)
{
create
(
:issue
,
project:
project
,
title:
'updated very old'
,
updated_at:
1
.
year
.
ago
)
}
let
(
:results_updated
)
{
described_class
.
new
(
user
,
'updated'
,
[
project
.
id
],
sort:
sort
)
}
before
do
ensure_elasticsearch_index!
end
include_examples
'search results sorted'
include_examples
'search results sorted'
do
let
(
:results_created
)
{
described_class
.
new
(
user
,
'sorted'
,
[
project
.
id
],
sort:
sort
)
}
let
(
:results_updated
)
{
described_class
.
new
(
user
,
'updated'
,
[
project
.
id
],
sort:
sort
)
}
end
end
end
...
...
ee/spec/services/search/global_service_spec.rb
View file @
bd195043
...
...
@@ -145,7 +145,7 @@ RSpec.describe Search::GlobalService do
end
context
'ordering'
do
let
!
(
:project
)
{
create
(
:project
,
:public
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
ee/spec/services/search/group_service_spec.rb
View file @
bd195043
...
...
@@ -242,7 +242,8 @@ RSpec.describe Search::GroupService, :elastic do
let
(
:scope
)
{
'issues'
}
context
'sorting'
do
let!
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
ee/spec/services/search/project_service_spec.rb
View file @
bd195043
...
...
@@ -184,7 +184,7 @@ RSpec.describe Search::ProjectService do
let
(
:scope
)
{
'issues'
}
context
'sorting'
,
:elastic
do
let
!
(
:project
)
{
create
(
:project
,
:public
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
@@ -209,7 +209,7 @@ RSpec.describe Search::ProjectService do
let
(
:scope
)
{
'merge_requests'
}
context
'sorting'
,
:elastic
do
let
!
(
:project
)
{
create
(
:project
,
:public
)
}
let
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:old_result
)
{
create
(
:merge_request
,
:opened
,
source_project:
project
,
source_branch:
'old-1'
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:merge_request
,
:opened
,
source_project:
project
,
source_branch:
'new-1'
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
spec/services/search/global_service_spec.rb
View file @
bd195043
...
...
@@ -57,7 +57,7 @@ RSpec.describe Search::GlobalService do
let
(
:scope
)
{
'issues'
}
context
'sorting'
do
let
!
(
:project
)
{
create
(
:project
,
:public
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
spec/services/search/group_service_spec.rb
View file @
bd195043
...
...
@@ -45,8 +45,8 @@ RSpec.describe Search::GroupService do
let
(
:scope
)
{
'issues'
}
context
'sorting'
do
let
!
(
:group
)
{
create
(
:group
)
}
let
!
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let
_it_be
(
:group
)
{
create
(
:group
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let!
(
:old_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted old'
,
created_at:
1
.
month
.
ago
)
}
let!
(
:new_result
)
{
create
(
:issue
,
project:
project
,
title:
'sorted recent'
,
created_at:
1
.
day
.
ago
)
}
...
...
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