Welcome to mirror list, hosted at ThFree Co, Russian Federation.

schedule_update_user_activity_worker_spec.rb « workers « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e583c3203aa04a48f1c63bbadb7f54e0bead453e (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
require 'spec_helper'

describe ScheduleUpdateUserActivityWorker, :redis do
  let(:now) { Time.now }

  before do
    Gitlab::UserActivities.record('1', now)
    Gitlab::UserActivities.record('2', now)
  end

  it 'schedules UpdateUserActivityWorker once' do
    expect(UpdateUserActivityWorker).to receive(:perform_async).with({ '1' => now.to_i.to_s, '2' => now.to_i.to_s })

    subject.perform
  end

  context 'when specifying a batch size' do
    it 'schedules UpdateUserActivityWorker twice' do
      expect(UpdateUserActivityWorker).to receive(:perform_async).with({ '1' => now.to_i.to_s })
      expect(UpdateUserActivityWorker).to receive(:perform_async).with({ '2' => now.to_i.to_s })

      subject.perform(1)
    end
  end
end