forbid users to import an exercise they do not have access to (previously a new one was created)

This commit is contained in:
Karol
2019-12-18 17:52:34 +01:00
parent 12c76b2fe4
commit f49cd0bed4
5 changed files with 24 additions and 4 deletions

View File

@ -155,8 +155,8 @@ describe ProformaService::Import do
context 'when another user imports the exercise' do
let(:import_user) { FactoryBot.create(:teacher) }
it 'raises a validation error' do
expect { imported_exercise.save! } .to raise_error ActiveRecord::RecordInvalid
it 'raises a proforma error' do
expect { imported_exercise.save! } .to raise_error Proforma::ExerciseNotOwned
end
end
end