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
6418b963
Commit
6418b963
authored
May 27, 2021
by
Adam Hegyi
Committed by
Vitali Tatarintev
May 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow editing persisted value stream
parent
22f9fdf4
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
12 deletions
+27
-12
ee/app/models/analytics/cycle_analytics/group_value_stream.rb
...pp/models/analytics/cycle_analytics/group_value_stream.rb
+1
-1
ee/spec/controllers/groups/analytics/cycle_analytics/value_streams_controller_spec.rb
...nalytics/cycle_analytics/value_streams_controller_spec.rb
+0
-11
ee/spec/factories/analytics/cycle_analytics/group_value_streams.rb
...actories/analytics/cycle_analytics/group_value_streams.rb
+2
-0
ee/spec/models/analytics/cycle_analytics/group_value_stream_spec.rb
...dels/analytics/cycle_analytics/group_value_stream_spec.rb
+24
-0
No files found.
ee/app/models/analytics/cycle_analytics/group_value_stream.rb
View file @
6418b963
...
...
@@ -13,6 +13,6 @@ class Analytics::CycleAnalytics::GroupValueStream < ApplicationRecord
scope
:preload_associated_models
,
->
{
includes
(
:group
,
stages:
[
:group
,
:end_event_label
,
:start_event_label
])
}
def
custom?
name
!=
Analytics
::
CycleAnalytics
::
Stages
::
BaseService
::
DEFAULT_VALUE_STREAM_NAME
persisted?
||
name
!=
Analytics
::
CycleAnalytics
::
Stages
::
BaseService
::
DEFAULT_VALUE_STREAM_NAME
end
end
ee/spec/controllers/groups/analytics/cycle_analytics/value_streams_controller_spec.rb
View file @
6418b963
...
...
@@ -178,17 +178,6 @@ RSpec.describe Groups::Analytics::CycleAnalytics::ValueStreamsController do
delete
:destroy
,
params:
{
group_id:
group
,
id:
value_stream
}
end
context
'when it is a default value stream'
do
let!
(
:value_stream
)
{
create
(
:cycle_analytics_group_value_stream
,
group:
group
,
name:
'default'
)
}
it
'returns an unprocessable entity 422 response without deleting the value stream'
do
expect
{
destroy_value_stream
}.
not_to
change
{
Analytics
::
CycleAnalytics
::
GroupValueStream
.
count
}
expect
(
response
).
to
have_gitlab_http_status
(
:unprocessable_entity
)
expect
(
json_response
[
"message"
]).
to
eq
(
'The Default Value Stream cannot be deleted'
)
end
end
context
'when it is a custom value stream'
do
let!
(
:value_stream
)
{
create
(
:cycle_analytics_group_value_stream
,
group:
group
,
name:
'some custom value stream'
)
}
let!
(
:stage
)
{
create
(
:cycle_analytics_group_stage
,
value_stream:
value_stream
)
}
...
...
ee/spec/factories/analytics/cycle_analytics/group_value_streams.rb
View file @
6418b963
...
...
@@ -3,5 +3,7 @@
FactoryBot
.
define
do
factory
:cycle_analytics_group_value_stream
,
class:
'Analytics::CycleAnalytics::GroupValueStream'
do
sequence
(
:name
)
{
|
n
|
"Value Stream #
#{
n
}
"
}
group
end
end
ee/spec/models/analytics/cycle_analytics/group_value_stream_spec.rb
View file @
6418b963
...
...
@@ -45,4 +45,28 @@ RSpec.describe Analytics::CycleAnalytics::GroupValueStream, type: :model do
end
end
end
describe
'#custom?'
do
context
'when value stream is not persisted'
do
subject
(
:value_stream
)
{
build
(
:cycle_analytics_group_value_stream
,
name:
value_stream_name
)
}
context
'when the name of the value stream is default'
do
let
(
:value_stream_name
)
{
Analytics
::
CycleAnalytics
::
Stages
::
BaseService
::
DEFAULT_VALUE_STREAM_NAME
}
it
{
is_expected
.
not_to
be_custom
}
end
context
'when the name of the value stream is not default'
do
let
(
:value_stream_name
)
{
'value_stream_1'
}
it
{
is_expected
.
to
be_custom
}
end
end
context
'when value stream is persisted'
do
subject
(
:value_stream
)
{
create
(
:cycle_analytics_group_value_stream
,
name:
'value_stream_1'
)
}
it
{
is_expected
.
to
be_custom
}
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