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
687eba80
Commit
687eba80
authored
Apr 28, 2021
by
Huzaifa Iftikhar
Committed by
Kerri Miller
Apr 28, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Rails/SaveBang Rubocop offenses for member models
parent
3c50a67b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
.rubocop_manual_todo.yml
.rubocop_manual_todo.yml
+0
-3
changelogs/unreleased/issue-220040-fix-rails-savebang-member-related-models.yml
...issue-220040-fix-rails-savebang-member-related-models.yml
+5
-0
spec/models/member_spec.rb
spec/models/member_spec.rb
+5
-5
spec/models/members/group_member_spec.rb
spec/models/members/group_member_spec.rb
+2
-2
spec/models/members/project_member_spec.rb
spec/models/members/project_member_spec.rb
+2
-2
No files found.
.rubocop_manual_todo.yml
View file @
687eba80
...
...
@@ -221,9 +221,6 @@ Rails/SaveBang:
-
'
spec/models/jira_import_state_spec.rb'
-
'
spec/models/key_spec.rb'
-
'
spec/models/lfs_objects_project_spec.rb'
-
'
spec/models/member_spec.rb'
-
'
spec/models/members/group_member_spec.rb'
-
'
spec/models/members/project_member_spec.rb'
-
'
spec/models/merge_request_spec.rb'
-
'
spec/models/milestone_spec.rb'
-
'
spec/models/namespace_spec.rb'
...
...
changelogs/unreleased/issue-220040-fix-rails-savebang-member-related-models.yml
0 → 100644
View file @
687eba80
---
title
:
Fix Rails/SaveBang Rubocop offenses for member models
merge_request
:
57994
author
:
Huzaifa Iftikhar @huzaifaiftikhar
type
:
fixed
spec/models/member_spec.rb
View file @
687eba80
...
...
@@ -884,7 +884,7 @@ RSpec.describe Member do
user
=
create
(
:user
)
member
=
project
.
add_reporter
(
user
)
member
.
destroy
member
.
destroy
!
expect
(
user
.
authorized_projects
).
not_to
include
(
project
)
end
...
...
@@ -901,7 +901,7 @@ RSpec.describe Member do
with_them
do
describe
'create member'
do
let!
(
:source
)
{
create
(
source_type
)
}
let!
(
:source
)
{
create
(
source_type
)
}
# rubocop:disable Rails/SaveBang
subject
{
create
(
member_type
,
:guest
,
user:
user
,
source:
source
)
}
...
...
@@ -913,20 +913,20 @@ RSpec.describe Member do
describe
'update member'
do
context
'when access level was changed'
do
subject
{
member
.
update
(
access_level:
Gitlab
::
Access
::
GUEST
)
}
subject
{
member
.
update
!
(
access_level:
Gitlab
::
Access
::
GUEST
)
}
include_examples
'update highest role with exclusive lease'
end
context
'when access level was not changed'
do
subject
{
member
.
update
(
notification_level:
NotificationSetting
.
levels
[
:disabled
])
}
subject
{
member
.
update
!
(
notification_level:
NotificationSetting
.
levels
[
:disabled
])
}
include_examples
'does not update the highest role'
end
end
describe
'destroy member'
do
subject
{
member
.
destroy
}
subject
{
member
.
destroy
!
}
include_examples
'update highest role with exclusive lease'
end
...
...
spec/models/members/group_member_spec.rb
View file @
687eba80
...
...
@@ -85,11 +85,11 @@ RSpec.describe GroupMember do
expect
(
user
).
to
receive
(
:update_two_factor_requirement
)
group_member
.
save
group_member
.
save
!
expect
(
user
).
to
receive
(
:update_two_factor_requirement
)
group_member
.
destroy
group_member
.
destroy
!
end
end
...
...
spec/models/members/project_member_spec.rb
View file @
687eba80
...
...
@@ -49,13 +49,13 @@ RSpec.describe ProjectMember do
it
"creates an expired event when left due to expiry"
do
expired
=
create
(
:project_member
,
project:
project
,
expires_at:
1
.
day
.
from_now
)
travel_to
(
2
.
days
.
from_now
)
{
expired
.
destroy
}
travel_to
(
2
.
days
.
from_now
)
{
expired
.
destroy
!
}
expect
(
Event
.
recent
.
first
).
to
be_expired_action
end
it
"creates a left event when left due to leave"
do
maintainer
.
destroy
maintainer
.
destroy
!
expect
(
Event
.
recent
.
first
).
to
be_left_action
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