diff options
author | Marcel Amirault <mamirault@gitlab.com> | 2019-07-10 05:56:23 +0000 |
---|---|---|
committer | Marcel Amirault <mamirault@gitlab.com> | 2019-07-10 05:56:23 +0000 |
commit | 2b03a0c2cf699074ec37a863e5c752a2cab2b133 (patch) | |
tree | 7ebc289d2ec498fcebf8ae454cdb1eb1ef500dbd /spec/models/project_statistics_spec.rb | |
parent | c0deda7a86796c5de6ebe376c83f55af0965bde3 (diff) | |
parent | 810df4fb51bf3db4016c5f7458599331d4586300 (diff) | |
download | gitlab-ce-docs-hard-tabs.tar.gz |
Merge branch 'master' into 'docs-hard-tabs'docs-hard-tabs
# Conflicts:
# doc/administration/pseudonymizer.md
# doc/administration/uploads.md
Diffstat (limited to 'spec/models/project_statistics_spec.rb')
-rw-r--r-- | spec/models/project_statistics_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/spec/models/project_statistics_spec.rb b/spec/models/project_statistics_spec.rb index 1cb49d83ffa..db3e4902c64 100644 --- a/spec/models/project_statistics_spec.rb +++ b/spec/models/project_statistics_spec.rb @@ -135,6 +135,49 @@ describe ProjectStatistics do expect(statistics.wiki_size).to eq(0) end end + + context 'when the column is namespace relatable' do + let(:namespace) { create(:group) } + let(:project) { create(:project, namespace: namespace) } + + context 'when the feature flag is off' do + it 'does not schedule the aggregation worker' do + stub_feature_flags(update_statistics_namespace: false, namespace: namespace) + + expect(Namespaces::ScheduleAggregationWorker) + .not_to receive(:perform_async) + + statistics.refresh!(only: [:lfs_objects_size]) + end + end + + context 'when the feature flag is on' do + it 'schedules the aggregation worker' do + expect(Namespaces::ScheduleAggregationWorker) + .to receive(:perform_async) + + statistics.refresh!(only: [:lfs_objects_size]) + end + end + + context 'when no argument is passed' do + it 'schedules the aggregation worker' do + expect(Namespaces::ScheduleAggregationWorker) + .to receive(:perform_async) + + statistics.refresh! + end + end + end + + context 'when the column is not namespace relatable' do + it 'does not schedules an aggregation worker' do + expect(Namespaces::ScheduleAggregationWorker) + .not_to receive(:perform_async) + + statistics.refresh!(only: [:commit_count]) + end + end end describe '#update_commit_count' do |