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
d443cea0
Commit
d443cea0
authored
Aug 20, 2021
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve epics resolver specs
Small performance improvements
parent
ac2526bc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
ee/spec/graphql/resolvers/epics_resolver_spec.rb
ee/spec/graphql/resolvers/epics_resolver_spec.rb
+10
-14
No files found.
ee/spec/graphql/resolvers/epics_resolver_spec.rb
View file @
d443cea0
...
...
@@ -11,12 +11,15 @@ RSpec.describe Resolvers::EpicsResolver do
context
"with a group"
do
let_it_be_with_refind
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let
(
:epic1
)
{
create
(
:epic
,
group:
group
,
state: :closed
,
created_at:
3
.
days
.
ago
,
updated_at:
2
.
days
.
ago
)
}
let
(
:epic2
)
{
create
(
:epic
,
group:
group
,
author:
user2
,
title:
'foo'
,
description:
'bar'
,
created_at:
2
.
days
.
ago
,
updated_at:
3
.
days
.
ago
)
}
let
_it_be
(
:project
)
{
create
(
:project
,
:public
,
group:
group
)
}
let
_it_be
(
:epic1
)
{
create
(
:epic
,
group:
group
,
state: :closed
,
title:
'first created'
,
created_at:
3
.
days
.
ago
,
updated_at:
2
.
days
.
ago
,
start_date:
10
.
days
.
ago
,
end_date:
10
.
days
.
from_now
)
}
let
_it_be
(
:epic2
)
{
create
(
:epic
,
group:
group
,
author:
user2
,
title:
'second created'
,
description:
'text 1'
,
created_at:
2
.
days
.
ago
,
updated_at:
3
.
days
.
ago
,
start_date:
20
.
days
.
ago
,
end_date:
20
.
days
.
from_now
)
}
before
do
before
_all
do
group
.
add_developer
(
current_user
)
end
before
do
stub_licensed_features
(
epics:
true
)
end
...
...
@@ -83,25 +86,20 @@ RSpec.describe Resolvers::EpicsResolver do
end
context
'with state'
do
let!
(
:epic1
)
{
create
(
:epic
,
group:
group
,
state: :opened
,
start_date:
"2019-08-13"
,
end_date:
"2019-08-20"
)
}
let!
(
:epic2
)
{
create
(
:epic
,
group:
group
,
state: :closed
,
start_date:
"2019-08-13"
,
end_date:
"2019-08-21"
)
}
it
'lists epics with opened state'
do
epics
=
resolve_epics
(
state:
'opened'
)
expect
(
epics
).
to
match_array
([
epic
1
])
expect
(
epics
).
to
match_array
([
epic
2
])
end
it
'lists epics with closed state'
do
epics
=
resolve_epics
(
state:
'closed'
)
expect
(
epics
).
to
match_array
([
epic
2
])
expect
(
epics
).
to
match_array
([
epic
1
])
end
end
context
'with search'
do
let!
(
:epic1
)
{
create
(
:epic
,
group:
group
,
title:
'first created'
,
description:
'description'
)
}
let!
(
:epic2
)
{
create
(
:epic
,
group:
group
,
title:
'second created'
,
description:
'text 1'
)
}
let!
(
:epic3
)
{
create
(
:epic
,
group:
group
,
title:
'third'
,
description:
'text 2'
)
}
it
'filters epics by title'
do
...
...
@@ -208,8 +206,6 @@ RSpec.describe Resolvers::EpicsResolver do
end
context
'with sort'
do
let!
(
:epic1
)
{
create
(
:epic
,
group:
group
,
title:
'first created'
,
description:
'description'
,
start_date:
10
.
days
.
ago
,
end_date:
10
.
days
.
from_now
)
}
let!
(
:epic2
)
{
create
(
:epic
,
group:
group
,
title:
'second created'
,
description:
'text 1'
,
start_date:
20
.
days
.
ago
,
end_date:
20
.
days
.
from_now
)
}
let!
(
:epic3
)
{
create
(
:epic
,
group:
group
,
title:
'third'
,
description:
'text 2'
,
start_date:
30
.
days
.
ago
,
end_date:
30
.
days
.
from_now
)
}
let!
(
:epic4
)
{
create
(
:epic
,
group:
group
,
title:
'forth created'
,
description:
'four'
,
start_date:
40
.
days
.
ago
,
end_date:
40
.
days
.
from_now
)
}
...
...
@@ -303,7 +299,7 @@ RSpec.describe Resolvers::EpicsResolver do
it
'returns the expected epics if just the first number of iid is requested'
do
epics
=
resolve_epics
(
iid_starts_with:
'1'
)
expect
(
epics
).
to
contain_exactly
(
epic3
,
epic4
)
expect
(
epics
).
to
contain_exactly
(
epic
1
,
epic
3
,
epic4
)
end
it
'returns the expected epics if first two numbers of iid are requested'
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