Commit 602f6bc8 authored by Michael Kozono's avatar Michael Kozono

Make sure empty uploads doesn’t break anything

parent fcbd2fe6
...@@ -5,6 +5,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do ...@@ -5,6 +5,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
include TrackUntrackedUploadsHelpers include TrackUntrackedUploadsHelpers
let(:untracked_files_for_uploads) { table(:untracked_files_for_uploads) } let(:untracked_files_for_uploads) { table(:untracked_files_for_uploads) }
let(:uploads) { table(:uploads) }
matcher :be_scheduled_migration do matcher :be_scheduled_migration do
match do |migration| match do |migration|
...@@ -33,7 +34,6 @@ describe TrackUntrackedUploads, :migration, :sidekiq do ...@@ -33,7 +34,6 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
let!(:user2) { create(:user, :with_avatar) } let!(:user2) { create(:user, :with_avatar) }
let!(:project1) { create(:project, :with_avatar) } let!(:project1) { create(:project, :with_avatar) }
let!(:project2) { create(:project, :with_avatar) } let!(:project2) { create(:project, :with_avatar) }
let(:uploads) { table(:uploads) }
before do before do
UploadService.new(project1, uploaded_file, FileUploader).execute # Markdown upload UploadService.new(project1, uploaded_file, FileUploader).execute # Markdown upload
...@@ -90,4 +90,12 @@ describe TrackUntrackedUploads, :migration, :sidekiq do ...@@ -90,4 +90,12 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
expect(table_exists?(:untracked_files_for_uploads)).to be_falsey expect(table_exists?(:untracked_files_for_uploads)).to be_falsey
end end
end end
context 'without any uploads ever' do
it 'does not add any upload records' do
expect do
migrate!
end.not_to change { uploads.count }.from(0)
end
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