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
1dde18f3
Commit
1dde18f3
authored
Jul 16, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add code review remarks
Make specs more readable
parent
72cddf5a
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
61 additions
and
65 deletions
+61
-65
app/models/cycle_analytics/group_level.rb
app/models/cycle_analytics/group_level.rb
+1
-1
app/models/cycle_analytics/level_base.rb
app/models/cycle_analytics/level_base.rb
+1
-1
app/models/cycle_analytics/project_level.rb
app/models/cycle_analytics/project_level.rb
+1
-1
lib/gitlab/cycle_analytics/permissions.rb
lib/gitlab/cycle_analytics/permissions.rb
+1
-1
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
+14
-16
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
+1
-0
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
+10
-12
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
+14
-16
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
+9
-8
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
+8
-8
spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
+1
-1
No files found.
app/models/cycle_analytics/group_level.rb
View file @
1dde18f3
...
...
@@ -2,7 +2,7 @@
module
CycleAnalytics
class
GroupLevel
include
BaseMethods
include
LevelBase
attr_reader
:options
def
initialize
(
options
:)
...
...
app/models/cycle_analytics/
base_methods
.rb
→
app/models/cycle_analytics/
level_base
.rb
View file @
1dde18f3
# frozen_string_literal: true
module
CycleAnalytics
module
BaseMethods
module
LevelBase
STAGES
=
%i[issue plan code test review staging production]
.
freeze
def
all_medians_by_stage
...
...
app/models/cycle_analytics/project_level.rb
View file @
1dde18f3
...
...
@@ -2,7 +2,7 @@
module
CycleAnalytics
class
ProjectLevel
include
BaseMethods
include
LevelBase
attr_reader
:project
,
:options
def
initialize
(
project
,
options
:)
...
...
lib/gitlab/cycle_analytics/permissions.rb
View file @
1dde18f3
...
...
@@ -23,7 +23,7 @@ module Gitlab
end
def
get
::
CycleAnalytics
::
BaseMethods
::
STAGES
.
each
do
|
stage
|
::
CycleAnalytics
::
LevelBase
::
STAGES
.
each
do
|
stage
|
@stage_permission_hash
[
stage
]
=
authorized_stage?
(
stage
)
end
...
...
spec/lib/gitlab/cycle_analytics/code_stage_spec.rb
View file @
1dde18f3
...
...
@@ -34,11 +34,11 @@ describe Gitlab::CycleAnalytics::CodeStage do
end
describe
'#events'
do
it
'exposes merge requests that closes issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_1
.
title
,
mr_2
.
title
)
it
'exposes merge requests that closes issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_1
.
title
,
mr_2
.
title
)
end
end
...
...
@@ -74,11 +74,11 @@ describe Gitlab::CycleAnalytics::CodeStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
)
end
end
...
...
@@ -101,18 +101,16 @@ describe Gitlab::CycleAnalytics::CodeStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
,
mr_3_1
.
title
,
mr_3_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
,
mr_3_1
.
title
,
mr_3_2
.
title
)
end
it
'exposes merge requests that close issues with full path for subgroup'
do
result
=
stage
.
events
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
find
{
|
event
|
event
[
:title
]
==
mr_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
find
{
|
event
|
event
[
:title
]
==
mr_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/group_stage_summary_spec.rb
View file @
1dde18f3
...
...
@@ -7,6 +7,7 @@ describe Gitlab::CycleAnalytics::GroupStageSummary do
let
(
:project_2
)
{
create
(
:project
,
:repository
,
namespace:
group
)
}
let
(
:from
)
{
1
.
day
.
ago
}
let
(
:user
)
{
create
(
:user
,
:admin
)
}
subject
{
described_class
.
new
(
group
,
from:
Time
.
now
,
current_user:
user
).
data
}
describe
"#new_issues"
do
...
...
spec/lib/gitlab/cycle_analytics/issue_stage_spec.rb
View file @
1dde18f3
...
...
@@ -63,11 +63,11 @@ describe Gitlab::CycleAnalytics::IssueStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
)
end
end
...
...
@@ -85,18 +85,16 @@ describe Gitlab::CycleAnalytics::IssueStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
,
issue_3_1
.
title
,
issue_3_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
,
issue_3_1
.
title
,
issue_3_2
.
title
)
end
it
'exposes merge requests that close issues with full path for subgroup'
do
result
=
stage
.
events
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
find
{
|
event
|
event
[
:title
]
==
issue_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
find
{
|
event
|
event
[
:title
]
==
issue_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/plan_stage_spec.rb
View file @
1dde18f3
...
...
@@ -29,11 +29,11 @@ describe Gitlab::CycleAnalytics::PlanStage do
end
describe
'#events'
do
it
'exposes issues with metrics'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_1
.
title
,
issue_2
.
title
)
it
'exposes issues with metrics'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_1
.
title
,
issue_2
.
title
)
end
end
...
...
@@ -65,11 +65,11 @@ describe Gitlab::CycleAnalytics::PlanStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
)
end
end
...
...
@@ -88,18 +88,16 @@ describe Gitlab::CycleAnalytics::PlanStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
,
issue_3_1
.
title
,
issue_3_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
issue_2_1
.
title
,
issue_2_2
.
title
,
issue_3_1
.
title
,
issue_3_2
.
title
)
end
it
'exposes merge requests that close issues with full path for subgroup'
do
result
=
stage
.
events
expect
(
result
.
count
).
to
eq
(
4
)
expect
(
result
.
find
{
|
event
|
event
[
:title
]
==
issue_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
expect
(
subject
.
count
).
to
eq
(
4
)
expect
(
subject
.
find
{
|
event
|
event
[
:title
]
==
issue_3_1
.
title
}[
:url
]).
to
include
(
"
#{
subgroup
.
full_path
}
"
)
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/review_stage_spec.rb
View file @
1dde18f3
...
...
@@ -35,13 +35,14 @@ describe Gitlab::CycleAnalytics::ReviewStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_1
.
title
,
mr_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_1
.
title
,
mr_2
.
title
)
end
end
context
'when group is given'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
...
...
@@ -77,11 +78,11 @@ describe Gitlab::CycleAnalytics::ReviewStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:title
]
}).
to
contain_exactly
(
mr_2_1
.
title
,
mr_2_2
.
title
)
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/staging_stage_spec.rb
View file @
1dde18f3
...
...
@@ -39,11 +39,11 @@ describe Gitlab::CycleAnalytics::StagingStage do
end
describe
'#events'
do
it
'exposes builds connected to merge request'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:name
]
}).
to
contain_exactly
(
build_1
.
name
,
build_2
.
name
)
it
'exposes builds connected to merge request'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:name
]
}).
to
contain_exactly
(
build_1
.
name
,
build_2
.
name
)
end
end
...
...
@@ -84,11 +84,11 @@ describe Gitlab::CycleAnalytics::StagingStage do
end
describe
'#events'
do
it
'exposes merge requests that close issues'
do
result
=
stage
.
events
subject
{
stage
.
events
}
expect
(
result
.
count
).
to
eq
(
2
)
expect
(
result
.
map
{
|
event
|
event
[
:name
]
}).
to
contain_exactly
(
build_1
.
name
,
build_2
.
name
)
it
'exposes merge requests that close issues'
do
expect
(
subject
.
count
).
to
eq
(
2
)
expect
(
subject
.
map
{
|
event
|
event
[
:name
]
}).
to
contain_exactly
(
build_1
.
name
,
build_2
.
name
)
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/usage_data_spec.rb
View file @
1dde18f3
...
...
@@ -34,7 +34,7 @@ describe Gitlab::CycleAnalytics::UsageData do
expect
(
result
).
to
have_key
(
:avg_cycle_analytics
)
CycleAnalytics
::
BaseMethods
::
STAGES
.
each
do
|
stage
|
CycleAnalytics
::
LevelBase
::
STAGES
.
each
do
|
stage
|
expect
(
result
[
:avg_cycle_analytics
]).
to
have_key
(
stage
)
stage_values
=
result
[
:avg_cycle_analytics
][
stage
]
...
...
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