Make sure empty uploads doesn’t break anything
This commit is contained in:
parent
fcbd2fe625
commit
602f6bc89c
|
@ -5,6 +5,7 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
|
|||
include TrackUntrackedUploadsHelpers
|
||||
|
||||
let(:untracked_files_for_uploads) { table(:untracked_files_for_uploads) }
|
||||
let(:uploads) { table(:uploads) }
|
||||
|
||||
matcher :be_scheduled_migration do
|
||||
match do |migration|
|
||||
|
@ -33,7 +34,6 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
|
|||
let!(:user2) { create(:user, :with_avatar) }
|
||||
let!(:project1) { create(:project, :with_avatar) }
|
||||
let!(:project2) { create(:project, :with_avatar) }
|
||||
let(:uploads) { table(:uploads) }
|
||||
|
||||
before do
|
||||
UploadService.new(project1, uploaded_file, FileUploader).execute # Markdown upload
|
||||
|
@ -90,4 +90,12 @@ describe TrackUntrackedUploads, :migration, :sidekiq do
|
|||
expect(table_exists?(:untracked_files_for_uploads)).to be_falsey
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue