diff --git a/app/controllers/hibernation_controller.rb b/app/controllers/hibernation_controller.rb index 42b4533efcb..cdea0cabdcf 100644 --- a/app/controllers/hibernation_controller.rb +++ b/app/controllers/hibernation_controller.rb @@ -18,7 +18,7 @@ def create destroy_subscription! notify_to_chat notify_to_mentors_and_admins - current_user.organizers_delete_and_assign_new + current_user.delete_and_assign_new_organizer logout redirect_to hibernation_path else diff --git a/app/controllers/retirement_controller.rb b/app/controllers/retirement_controller.rb index 7638ea2d747..9c45bc1e968 100644 --- a/app/controllers/retirement_controller.rb +++ b/app/controllers/retirement_controller.rb @@ -12,7 +12,7 @@ def create current_user.retired_on = Date.current if current_user.save(context: :retirement) user = current_user - current_user.organizers_delete_and_assign_new + current_user.delete_and_assign_new_organizer Newspaper.publish(:retirement_create, user) begin UserMailer.retire(user).deliver_now diff --git a/app/models/user.rb b/app/models/user.rb index d18982235b4..def7dd8db00 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -756,7 +756,7 @@ def become_watcher!(watchable) watches.find_or_create_by!(watchable:) end - def organizers_delete_and_assign_new + def delete_and_assign_new_organizer organizers.each(&:delete_and_assign_new) end diff --git a/test/models/user_test.rb b/test/models/user_test.rb index a1484f43081..5dc836a211d 100644 --- a/test/models/user_test.rb +++ b/test/models/user_test.rb @@ -679,11 +679,11 @@ class UserTest < ActiveSupport::TestCase assert_empty User.users_role(not_scope_name, allowed_targets: allowed_targets) end - test '#organizers_delete_and_assign_new' do + test '#delete_and_assign_new_organizer' do user = users(:hajime) assert_changes -> { Organizer.where(user: user).exists? }, from: true, to: false do - user.organizers_delete_and_assign_new + user.delete_and_assign_new_organizer end end end