fix (potential) problems with empty file_extensions

This commit is contained in:
Karol
2023-02-06 22:29:48 +01:00
committed by Sebastian Serth
parent 93188ba04d
commit 90d713a1d4
4 changed files with 22 additions and 4 deletions

View File

@ -157,6 +157,24 @@ describe ProformaService::ConvertTaskToExercise do
expect { convert_to_exercise_service.save! }.to change(Exercise, :count).by(1)
end
context 'when file is a Makefile' do
let(:filename) { "#{path}Makefile" }
it 'creates an exercise with a file with a Filetype, that has the correct attributes' do
expect(convert_to_exercise_service.files.first).to have_attributes(
file_type: be_a(FileType).and(have_attributes(file_extension: '', name: 'Imported'))
)
end
context 'when FileType for Makefile exists' do
let!(:makefile_filetype) { create(:makefile) }
it 'creates an exercise with a file with a Filetype, that has the correct attributes' do
expect(convert_to_exercise_service.files.first).to have_attributes(file_type: makefile_filetype)
end
end
end
context 'when file is a main_file' do
let(:meta_data) do
{