blob: 7366b1646b9e9a940305ec3ff5bdedd7eccb18da (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe Users::MigrateRecordsToGhostUserInBatchesService do
let(:service) { described_class.new }
let_it_be(:ghost_user_migration) { create(:ghost_user_migration) }
describe '#execute' do
it 'stops when execution time limit reached' do
expect_next_instance_of(::Gitlab::Utils::ExecutionTracker) do |tracker|
expect(tracker).to receive(:over_limit?).and_return(true)
end
expect(Users::MigrateRecordsToGhostUserService).not_to receive(:new)
service.execute
end
it 'calls Users::MigrateRecordsToGhostUserService' do
expect_next_instance_of(Users::MigrateRecordsToGhostUserService) do |service|
expect(service).to(
receive(:execute)
.with(hard_delete: ghost_user_migration.hard_delete))
end
service.execute
end
end
end
|