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
23aad127
Commit
23aad127
authored
Jul 02, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rearrange spec for readability
parent
d26f2708
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
22 deletions
+23
-22
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
+23
-22
No files found.
spec/lib/gitlab/cycle_analytics/test_stage_spec.rb
View file @
23aad127
...
...
@@ -4,33 +4,34 @@ require 'lib/gitlab/cycle_analytics/shared_stage_spec'
describe
Gitlab
::
CycleAnalytics
::
TestStage
do
let
(
:stage_name
)
{
:test
}
let
(
:project
)
{
create
(
:project
)
}
let!
(
:issue_1
)
{
create
(
:issue
,
project:
project
,
created_at:
90
.
minutes
.
ago
)
}
let!
(
:issue_2
)
{
create
(
:issue
,
project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:issue_3
)
{
create
(
:issue
,
project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:mr_1
)
{
create
(
:merge_request
,
:closed
,
source_project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:mr_2
)
{
create
(
:merge_request
,
:closed
,
source_project:
project
,
created_at:
40
.
minutes
.
ago
,
source_branch:
'A'
)
}
let!
(
:mr_3
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'B'
)
}
let!
(
:mr_4
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'C'
)
}
let!
(
:mr_5
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'D'
)
}
let
(
:stage
)
{
described_class
.
new
(
project:
project
,
options:
{
from:
2
.
days
.
ago
,
current_user:
project
.
creator
})
}
before
do
mr_1
.
metrics
.
update!
(
latest_build_started_at:
32
.
minutes
.
ago
,
latest_build_finished_at:
2
.
minutes
.
ago
)
mr_2
.
metrics
.
update!
(
latest_build_started_at:
62
.
minutes
.
ago
,
latest_build_finished_at:
32
.
minutes
.
ago
)
mr_3
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
mr_4
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
mr_5
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_1
,
issue:
issue_1
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_2
,
issue:
issue_2
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_3
,
issue:
issue_3
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_4
,
issue:
issue_3
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_5
,
issue:
issue_3
)
end
it_behaves_like
'base stage'
describe
'#median'
do
let!
(
:issue_1
)
{
create
(
:issue
,
project:
project
,
created_at:
90
.
minutes
.
ago
)
}
let!
(
:issue_2
)
{
create
(
:issue
,
project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:issue_3
)
{
create
(
:issue
,
project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:mr_1
)
{
create
(
:merge_request
,
:closed
,
source_project:
project
,
created_at:
60
.
minutes
.
ago
)
}
let!
(
:mr_2
)
{
create
(
:merge_request
,
:closed
,
source_project:
project
,
created_at:
40
.
minutes
.
ago
,
source_branch:
'A'
)
}
let!
(
:mr_3
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'B'
)
}
let!
(
:mr_4
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'C'
)
}
let!
(
:mr_5
)
{
create
(
:merge_request
,
source_project:
project
,
created_at:
10
.
minutes
.
ago
,
source_branch:
'D'
)
}
before
do
mr_1
.
metrics
.
update!
(
latest_build_started_at:
32
.
minutes
.
ago
,
latest_build_finished_at:
2
.
minutes
.
ago
)
mr_2
.
metrics
.
update!
(
latest_build_started_at:
62
.
minutes
.
ago
,
latest_build_finished_at:
32
.
minutes
.
ago
)
mr_3
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
mr_4
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
mr_5
.
metrics
.
update!
(
latest_build_started_at:
nil
,
latest_build_finished_at:
nil
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_1
,
issue:
issue_1
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_2
,
issue:
issue_2
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_3
,
issue:
issue_3
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_4
,
issue:
issue_3
)
create
(
:merge_requests_closing_issues
,
merge_request:
mr_5
,
issue:
issue_3
)
end
around
do
|
example
|
Timecop
.
freeze
{
example
.
run
}
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