Commit 687eba80 authored by Huzaifa Iftikhar's avatar Huzaifa Iftikhar Committed by Kerri Miller

Fix Rails/SaveBang Rubocop offenses for member models

parent 3c50a67b
......@@ -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'
......
---
title: Fix Rails/SaveBang Rubocop offenses for member models
merge_request: 57994
author: Huzaifa Iftikhar @huzaifaiftikhar
type: fixed
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment