debian-mirror-gitlab/spec/support/helpers/stubbed_member.rb
2022-08-27 11:52:29 +05:30

28 lines
763 B
Ruby

# frozen_string_literal: true
# Extend the ProjectMember & GroupMember class with the ability to
# to run project_authorizations refresh jobs inline.
# This is needed so that calls like `group.add_member(user, access_level)` or `create(:project_member)`
# in the specs can be run without including `:sidekiq_inline` trait.
module StubbedMember
extend ActiveSupport::Concern
module Member
private
def refresh_member_authorized_projects(blocking:)
return super unless blocking
AuthorizedProjectsWorker.new.perform(user_id)
end
end
module ProjectMember
private
def blocking_project_authorizations_refresh
AuthorizedProjectUpdate::ProjectRecalculatePerUserWorker.new.perform(project.id, user.id)
end
end
end