Commit 282f6940 authored by Guillaume Chauvel's avatar Guillaume Chauvel Committed by Guillaume CHAUVEL

Add upload project statistics test

parent 0f316f43
......@@ -242,4 +242,28 @@ RSpec.describe Upload do
it { expect(subject.uploader_context).to match(a_hash_including(secret: 'secret', identifier: 'file.txt')) }
end
describe '#update_project_statistics' do
let_it_be(:project) { create(:project) }
subject do
create(:upload, model: project)
end
it 'updates project statistics when upload is added' do
expect(ProjectCacheWorker).to receive(:perform_async)
.with(project.id, [], [:uploads_size])
subject.save!
end
it 'updates project statistics when upload is removed' do
subject.save!
expect(ProjectCacheWorker).to receive(:perform_async)
.with(project.id, [], [:uploads_size])
subject.destroy!
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment