8b73df0cf5
If the project is in a group, the `group.refresh_members_authorized_projects` is made non-blocking, and we call `current_user.refresh_authorized_projects` directly. Projects in a personal namespace are more difficult. Rather than passing the `blocking:` parameter through the entire `add_master` chain, have the `AuthorizedProjectsWorker` automatically inline authorizations for three IDs or less. Since the maximum number of IDs in this path is 2, that has the same effect.
19 lines
497 B
Ruby
19 lines
497 B
Ruby
require 'spec_helper'
|
|
|
|
describe UserProjectAccessChangedService do
|
|
describe '#execute' do
|
|
it 'schedules the user IDs' do
|
|
expect(AuthorizedProjectsWorker).to receive(:bulk_perform_and_wait)
|
|
.with([[1], [2]])
|
|
|
|
described_class.new([1, 2]).execute
|
|
end
|
|
|
|
it 'permits non-blocking operation' do
|
|
expect(AuthorizedProjectsWorker).to receive(:bulk_perform_async)
|
|
.with([[1], [2]])
|
|
|
|
described_class.new([1, 2]).execute(blocking: false)
|
|
end
|
|
end
|
|
end
|