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
e6c61c89
Commit
e6c61c89
authored
Jul 16, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timecop remarks
parent
1dde18f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
30 deletions
+54
-30
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
+54
-30
No files found.
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
View file @
e6c61c89
...
...
@@ -11,56 +11,80 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
subject
{
described_class
.
new
(
group
,
from:
Time
.
now
,
current_user:
user
).
data
}
describe
"#new_issues"
do
it
"finds the number of issues created after the 'from date'"
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:issue
,
project:
project_2
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
context
'with from date'
do
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:issue
,
project:
project_2
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
end
expect
(
subject
.
first
[
:value
]).
to
eq
(
2
)
it
"finds the number of issues created after it"
do
expect
(
subject
.
first
[
:value
]).
to
eq
(
2
)
end
end
it
"doesn't find issues from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
,
namespace:
create
(
:group
)))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
context
'with other projects'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
,
namespace:
create
(
:group
)))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
end
expect
(
subject
.
first
[
:value
]).
to
eq
(
2
)
it
"doesn't find issues from them"
do
expect
(
subject
.
first
[
:value
]).
to
eq
(
2
)
end
end
it
"finds issues from subgroups"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
,
namespace:
create
(
:group
,
parent:
group
)))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
context
'with subgroups'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
create
(
:project
,
namespace:
create
(
:group
,
parent:
group
)))
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:issue
,
project:
project_2
)
}
end
expect
(
subject
.
first
[
:value
]).
to
eq
(
3
)
it
"finds issues from them"
do
expect
(
subject
.
first
[
:value
]).
to
eq
(
3
)
end
end
end
describe
"#deploys"
do
it
"finds the number of deploys made created after the 'from date'"
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:deployment
,
:success
,
project:
project_2
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
:success
,
project:
project_2
)
}
context
'with from date'
do
before
do
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
:success
,
project:
project
)
}
Timecop
.
freeze
(
5
.
days
.
ago
)
{
create
(
:deployment
,
:success
,
project:
project_2
)
}
Timecop
.
freeze
(
5
.
days
.
from_now
)
{
create
(
:deployment
,
:success
,
project:
project_2
)
}
end
expect
(
subject
.
second
[
:value
]).
to
eq
(
2
)
it
"finds the number of deploys made created after it"
do
expect
(
subject
.
second
[
:value
]).
to
eq
(
2
)
end
end
it
"doesn't find deploys from other projects"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
:success
,
project:
create
(
:project
,
:repository
,
namespace:
create
(
:group
)))
context
'with other projects'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
:success
,
project:
create
(
:project
,
:repository
,
namespace:
create
(
:group
)))
end
end
expect
(
subject
.
second
[
:value
]).
to
eq
(
0
)
it
"doesn't find deploys from them"
do
expect
(
subject
.
second
[
:value
]).
to
eq
(
0
)
end
end
it
"finds deploys from subgroups"
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
:success
,
project:
create
(
:project
,
:repository
,
namespace:
create
(
:group
,
parent:
group
)))
context
'with subgroups'
do
before
do
Timecop
.
freeze
(
5
.
days
.
from_now
)
do
create
(
:deployment
,
:success
,
project:
create
(
:project
,
:repository
,
namespace:
create
(
:group
,
parent:
group
)))
end
end
expect
(
subject
.
second
[
:value
]).
to
eq
(
1
)
it
"finds deploys from them"
do
expect
(
subject
.
second
[
:value
]).
to
eq
(
1
)
end
end
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