diff options
Diffstat (limited to 'spec/workers')
-rw-r--r-- | spec/workers/namespaces/root_statistics_worker_spec.rb | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/spec/workers/namespaces/root_statistics_worker_spec.rb b/spec/workers/namespaces/root_statistics_worker_spec.rb index 45e75c9b0da..910a5b23e17 100644 --- a/spec/workers/namespaces/root_statistics_worker_spec.rb +++ b/spec/workers/namespaces/root_statistics_worker_spec.rb @@ -74,4 +74,19 @@ describe Namespaces::RootStatisticsWorker, '#perform' do worker.perform(group.id) end end + + it_behaves_like 'an idempotent worker' do + let(:job_args) { [group.id] } + + it 'deletes one aggregation schedule' do + # Make sure the group and it's aggregation schedule are created before + # counting + group + + expect { worker.perform(*job_args) } + .to change { Namespace::AggregationSchedule.count }.by(-1) + expect { worker.perform(*job_args) } + .not_to change { Namespace::AggregationSchedule.count } + end + end end |