site_statistics_rake_spec.rb 620 Bytes
Newer Older
1
2
3
4
5
6
7
8
# frozen_string_literal: true
require 'rake_helper'

describe 'rake gitlab:refresh_site_statistics' do
  before do
    Rake.application.rake_require 'tasks/gitlab/site_statistics'

    create(:project)
9
    SiteStatistic.fetch.update(repositories_count: 0)
10
11
12
13
14
15
16
17
18
19
20
  end

  let(:task) { 'gitlab:refresh_site_statistics' }

  it 'recalculates existing counters' do
    run_rake_task(task)

    expect(SiteStatistic.fetch.repositories_count).to eq(1)
  end

  it 'displays message listing counters' do
21
    expect { run_rake_task(task) }.to output(/Updating Site Statistics counters:.* Repositories\.\.\. OK!/m).to_stdout
22
23
  end
end