diff options
Diffstat (limited to 'spec/lib/gitlab/usage_data_spec.rb')
-rw-r--r-- | spec/lib/gitlab/usage_data_spec.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/spec/lib/gitlab/usage_data_spec.rb b/spec/lib/gitlab/usage_data_spec.rb index c2d96369425..4d12bb6bd8c 100644 --- a/spec/lib/gitlab/usage_data_spec.rb +++ b/spec/lib/gitlab/usage_data_spec.rb @@ -54,6 +54,32 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do expect { subject }.to raise_error('Stopped calculating recorded_at') end + + context 'when generating usage ping in critical weeks' do + it 'does not raise error when generated in last week of the year' do + travel_to(DateTime.parse('2020-12-29')) do + expect { subject }.not_to raise_error + end + end + + it 'does not raise error when generated in first week of the year' do + travel_to(DateTime.parse('2021-01-01')) do + expect { subject }.not_to raise_error + end + end + + it 'does not raise error when generated in second week of the year' do + travel_to(DateTime.parse('2021-01-07')) do + expect { subject }.not_to raise_error + end + end + + it 'does not raise error when generated in 3rd week of the year' do + travel_to(DateTime.parse('2021-01-14')) do + expect { subject }.not_to raise_error + end + end + end end describe 'usage_activity_by_stage_package' do |