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
951b22d6
Commit
951b22d6
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/services/issues/*
Fixes Rails/SaveBang cop for spec files
parent
7e0e3508
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
20 deletions
+20
-20
.rubocop_todo.yml
.rubocop_todo.yml
+0
-5
changelogs/unreleased/rails-save-bang-18.yml
changelogs/unreleased/rails-save-bang-18.yml
+5
-0
spec/services/issues/close_service_spec.rb
spec/services/issues/close_service_spec.rb
+1
-1
spec/services/issues/create_service_spec.rb
spec/services/issues/create_service_spec.rb
+3
-3
spec/services/issues/export_csv_service_spec.rb
spec/services/issues/export_csv_service_spec.rb
+2
-2
spec/services/issues/reopen_service_spec.rb
spec/services/issues/reopen_service_spec.rb
+1
-1
spec/services/issues/update_service_spec.rb
spec/services/issues/update_service_spec.rb
+8
-8
No files found.
.rubocop_todo.yml
View file @
951b22d6
...
...
@@ -1232,11 +1232,6 @@ Rails/SaveBang:
-
'
spec/services/issuable/bulk_update_service_spec.rb'
-
'
spec/services/issuable/clone/attributes_rewriter_spec.rb'
-
'
spec/services/issuable/common_system_notes_service_spec.rb'
-
'
spec/services/issues/close_service_spec.rb'
-
'
spec/services/issues/create_service_spec.rb'
-
'
spec/services/issues/export_csv_service_spec.rb'
-
'
spec/services/issues/reopen_service_spec.rb'
-
'
spec/services/issues/update_service_spec.rb'
-
'
spec/services/labels/promote_service_spec.rb'
-
'
spec/services/members/destroy_service_spec.rb'
-
'
spec/services/merge_requests/build_service_spec.rb'
...
...
changelogs/unreleased/rails-save-bang-18.yml
0 → 100644
View file @
951b22d6
---
title
:
Fix Rails/SaveBang offenses for spec/services/issues/*
merge_request
:
41312
author
:
Rajendra Kadam
type
:
fixed
spec/services/issues/close_service_spec.rb
View file @
951b22d6
...
...
@@ -288,7 +288,7 @@ RSpec.describe Issues::CloseService do
end
it
'deletes milestone issue counters cache'
do
issue
.
update
(
milestone:
create
(
:milestone
,
project:
project
))
issue
.
update
!
(
milestone:
create
(
:milestone
,
project:
project
))
expect_next_instance_of
(
Milestones
::
ClosedIssuesCountService
,
issue
.
milestone
)
do
|
service
|
expect
(
service
).
to
receive
(
:delete_cache
).
and_call_original
...
...
spec/services/issues/create_service_spec.rb
View file @
951b22d6
...
...
@@ -119,7 +119,7 @@ RSpec.describe Issues::CreateService do
end
before
do
project
.
update
(
group:
group
)
project
.
update
!
(
group:
group
)
end
it
'assigns group labels'
do
...
...
@@ -295,7 +295,7 @@ RSpec.describe Issues::CreateService do
context
"when issuable feature is private"
do
before
do
project
.
project_feature
.
update
(
issues_access_level:
ProjectFeature
::
PRIVATE
,
project
.
project_feature
.
update
!
(
issues_access_level:
ProjectFeature
::
PRIVATE
,
merge_requests_access_level:
ProjectFeature
::
PRIVATE
)
end
...
...
@@ -303,7 +303,7 @@ RSpec.describe Issues::CreateService do
levels
.
each
do
|
level
|
it
"removes not authorized assignee when project is
#{
Gitlab
::
VisibilityLevel
.
level_name
(
level
)
}
"
do
project
.
update
(
visibility_level:
level
)
project
.
update
!
(
visibility_level:
level
)
opts
=
{
title:
'Title'
,
description:
'Description'
,
assignee_ids:
[
assignee
.
id
]
}
issue
=
described_class
.
new
(
project
,
user
,
opts
).
execute
...
...
spec/services/issues/export_csv_service_spec.rb
View file @
951b22d6
...
...
@@ -38,8 +38,8 @@ RSpec.describe Issues::ExportCsvService do
before
do
# Creating a timelog touches the updated_at timestamp of issue,
# so create these first.
issue
.
timelogs
.
create
(
time_spent:
360
,
user:
user
)
issue
.
timelogs
.
create
(
time_spent:
200
,
user:
user
)
issue
.
timelogs
.
create
!
(
time_spent:
360
,
user:
user
)
issue
.
timelogs
.
create
!
(
time_spent:
200
,
user:
user
)
issue
.
update!
(
milestone:
milestone
,
assignees:
[
user
],
description:
'Issue with details'
,
...
...
spec/services/issues/reopen_service_spec.rb
View file @
951b22d6
...
...
@@ -44,7 +44,7 @@ RSpec.describe Issues::ReopenService do
end
it
'deletes milestone issue counters cache'
do
issue
.
update
(
milestone:
create
(
:milestone
,
project:
project
))
issue
.
update
!
(
milestone:
create
(
:milestone
,
project:
project
))
expect_next_instance_of
(
Milestones
::
ClosedIssuesCountService
,
issue
.
milestone
)
do
|
service
|
expect
(
service
).
to
receive
(
:delete_cache
).
and_call_original
...
...
spec/services/issues/update_service_spec.rb
View file @
951b22d6
...
...
@@ -354,7 +354,7 @@ RSpec.describe Issues::UpdateService, :mailer do
end
it
'does not update assignee_id with unauthorized users'
do
project
.
update
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
project
.
update
!
(
visibility_level:
Gitlab
::
VisibilityLevel
::
PUBLIC
)
update_issue
(
confidential:
true
)
non_member
=
create
(
:user
)
original_assignees
=
issue
.
assignees
...
...
@@ -457,7 +457,7 @@ RSpec.describe Issues::UpdateService, :mailer do
it
'sends notifications for subscribers of changed milestone'
,
:sidekiq_might_not_need_inline
do
issue
.
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
save
issue
.
save
!
perform_enqueued_jobs
do
update_issue
(
milestone_id:
""
)
...
...
@@ -470,7 +470,7 @@ RSpec.describe Issues::UpdateService, :mailer do
it
'clears milestone issue counters cache'
do
issue
.
milestone
=
create
(
:milestone
,
project:
project
)
issue
.
save
issue
.
save
!
expect_next_instance_of
(
Milestones
::
IssuesCountService
,
issue
.
milestone
)
do
|
service
|
expect
(
service
).
to
receive
(
:delete_cache
).
and_call_original
...
...
@@ -718,7 +718,7 @@ RSpec.describe Issues::UpdateService, :mailer do
let
(
:params
)
{
{
label_ids:
[
label
.
id
],
add_label_ids:
[
label3
.
id
]
}
}
before
do
issue
.
update
(
labels:
[
label2
])
issue
.
update
!
(
labels:
[
label2
])
end
it
'replaces the labels with the ones in label_ids and adds those in add_label_ids'
do
...
...
@@ -730,7 +730,7 @@ RSpec.describe Issues::UpdateService, :mailer do
let
(
:params
)
{
{
label_ids:
[
label
.
id
,
label2
.
id
,
label3
.
id
],
remove_label_ids:
[
label
.
id
]
}
}
before
do
issue
.
update
(
labels:
[
label
,
label3
])
issue
.
update
!
(
labels:
[
label
,
label3
])
end
it
'replaces the labels with the ones in label_ids and removes those in remove_label_ids'
do
...
...
@@ -742,7 +742,7 @@ RSpec.describe Issues::UpdateService, :mailer do
let
(
:params
)
{
{
add_label_ids:
[
label3
.
id
],
remove_label_ids:
[
label
.
id
]
}
}
before
do
issue
.
update
(
labels:
[
label
])
issue
.
update
!
(
labels:
[
label
])
end
it
'adds the passed labels'
do
...
...
@@ -759,7 +759,7 @@ RSpec.describe Issues::UpdateService, :mailer do
context
'for a label assigned to an issue'
do
it
'removes the label'
do
issue
.
update
(
labels:
[
label
])
issue
.
update
!
(
labels:
[
label
])
expect
(
result
.
label_ids
).
to
be_empty
end
...
...
@@ -808,7 +808,7 @@ RSpec.describe Issues::UpdateService, :mailer do
levels
.
each
do
|
level
|
it
"does not update with unauthorized assignee when project is
#{
Gitlab
::
VisibilityLevel
.
level_name
(
level
)
}
"
do
assignee
=
create
(
:user
)
project
.
update
(
visibility_level:
level
)
project
.
update
!
(
visibility_level:
level
)
feature_visibility_attr
=
:"
#{
issue
.
model_name
.
plural
}
_access_level"
project
.
project_feature
.
update_attribute
(
feature_visibility_attr
,
ProjectFeature
::
PRIVATE
)
...
...
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