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
867b1096
Commit
867b1096
authored
Sep 03, 2020
by
Rajendra Kadam
Committed by
Rémy Coutable
Sep 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang offenses for spec/models/cycle_analytics*
Fixes Rails/SaveBang cop for spec files
parent
e2e3b618
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
11 deletions
+13
-11
.rubocop_todo.yml
.rubocop_todo.yml
+0
-3
changelogs/unreleased/rails-save-bang-23.yml
changelogs/unreleased/rails-save-bang-23.yml
+5
-0
spec/models/cycle_analytics/issue_spec.rb
spec/models/cycle_analytics/issue_spec.rb
+4
-4
spec/models/cycle_analytics/plan_spec.rb
spec/models/cycle_analytics/plan_spec.rb
+3
-3
spec/models/cycle_analytics/production_spec.rb
spec/models/cycle_analytics/production_spec.rb
+1
-1
No files found.
.rubocop_todo.yml
View file @
867b1096
...
...
@@ -1111,9 +1111,6 @@ Rails/SaveBang:
-
'
spec/models/concerns/subscribable_spec.rb'
-
'
spec/models/concerns/token_authenticatable_spec.rb'
-
'
spec/models/container_repository_spec.rb'
-
'
spec/models/cycle_analytics/issue_spec.rb'
-
'
spec/models/cycle_analytics/plan_spec.rb'
-
'
spec/models/cycle_analytics/production_spec.rb'
-
'
spec/models/deploy_keys_project_spec.rb'
-
'
spec/models/deploy_token_spec.rb'
-
'
spec/models/deployment_spec.rb'
...
...
changelogs/unreleased/rails-save-bang-23.yml
0 → 100644
View file @
867b1096
---
title
:
Fix Rails/SaveBang offenses for spec/models/cycle_analytics/*
merge_request
:
41326
author
:
Rajendra Kadam
type
:
fixed
spec/models/cycle_analytics/issue_spec.rb
View file @
867b1096
...
...
@@ -15,17 +15,17 @@ RSpec.describe 'CycleAnalytics#issue' do
generate_cycle_analytics_spec
(
phase: :issue
,
data_fn:
->
(
context
)
{
{
issue:
context
.
build
(
:issue
,
project:
context
.
project
)
}
},
start_time_conditions:
[[
"issue created"
,
->
(
context
,
data
)
{
data
[
:issue
].
save
}]],
start_time_conditions:
[[
"issue created"
,
->
(
context
,
data
)
{
data
[
:issue
].
save
!
}]],
end_time_conditions:
[[
"issue associated with a milestone"
,
->
(
context
,
data
)
do
if
data
[
:issue
].
persisted?
data
[
:issue
].
update
(
milestone:
context
.
create
(
:milestone
,
project:
context
.
project
))
data
[
:issue
].
update
!
(
milestone:
context
.
create
(
:milestone
,
project:
context
.
project
))
end
end
],
[
"list label added to issue"
,
->
(
context
,
data
)
do
if
data
[
:issue
].
persisted?
data
[
:issue
].
update
(
label_ids:
[
context
.
create
(
:list
).
label_id
])
data
[
:issue
].
update
!
(
label_ids:
[
context
.
create
(
:list
).
label_id
])
end
end
]],
post_fn:
->
(
context
,
data
)
do
...
...
@@ -35,7 +35,7 @@ RSpec.describe 'CycleAnalytics#issue' do
it
"returns nil"
do
regular_label
=
create
(
:label
)
issue
=
create
(
:issue
,
project:
project
)
issue
.
update
(
label_ids:
[
regular_label
.
id
])
issue
.
update
!
(
label_ids:
[
regular_label
.
id
])
create_merge_request_closing_issue
(
user
,
project
,
issue
)
merge_merge_requests_closing_issue
(
user
,
project
,
issue
)
...
...
spec/models/cycle_analytics/plan_spec.rb
View file @
867b1096
...
...
@@ -22,11 +22,11 @@ RSpec.describe 'CycleAnalytics#plan' do
end
,
start_time_conditions:
[[
"issue associated with a milestone"
,
->
(
context
,
data
)
do
data
[
:issue
].
update
(
milestone:
context
.
create
(
:milestone
,
project:
context
.
project
))
data
[
:issue
].
update
!
(
milestone:
context
.
create
(
:milestone
,
project:
context
.
project
))
end
],
[
"list label added to issue"
,
->
(
context
,
data
)
do
data
[
:issue
].
update
(
label_ids:
[
context
.
create
(
:list
).
label_id
])
data
[
:issue
].
update
!
(
label_ids:
[
context
.
create
(
:list
).
label_id
])
end
]],
end_time_conditions:
[[
"issue mentioned in a commit"
,
->
(
context
,
data
)
do
...
...
@@ -40,7 +40,7 @@ RSpec.describe 'CycleAnalytics#plan' do
branch_name
=
generate
(
:branch
)
label
=
create
(
:label
)
issue
=
create
(
:issue
,
project:
project
)
issue
.
update
(
label_ids:
[
label
.
id
])
issue
.
update
!
(
label_ids:
[
label
.
id
])
create_commit_referencing_issue
(
issue
,
branch_name:
branch_name
)
create_merge_request_closing_issue
(
user
,
project
,
issue
,
source_branch:
branch_name
)
...
...
spec/models/cycle_analytics/production_spec.rb
View file @
867b1096
...
...
@@ -15,7 +15,7 @@ RSpec.describe 'CycleAnalytics#production' do
generate_cycle_analytics_spec
(
phase: :production
,
data_fn:
->
(
context
)
{
{
issue:
context
.
build
(
:issue
,
project:
context
.
project
)
}
},
start_time_conditions:
[[
"issue is created"
,
->
(
context
,
data
)
{
data
[
:issue
].
save
}]],
start_time_conditions:
[[
"issue is created"
,
->
(
context
,
data
)
{
data
[
:issue
].
save
!
}]],
before_end_fn:
lambda
do
|
context
,
data
|
context
.
create_merge_request_closing_issue
(
context
.
user
,
context
.
project
,
data
[
:issue
])
context
.
merge_merge_requests_closing_issue
(
context
.
user
,
context
.
project
,
data
[
:issue
])
...
...
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