Fix test for new custom file

This commit is contained in:
Sebastian Serth
2021-05-14 17:35:37 +02:00
parent bf6ab4f114
commit 48904a19fd
2 changed files with 3 additions and 2 deletions

View File

@ -6,7 +6,7 @@ module FileParameters
params.reject do |_, file_attributes|
file = CodeOcean::File.find_by(id: file_attributes[:file_id])
# avoid that public files from other contexts can be created
file.nil? || file.hidden || file.read_only || file.context == 'Exercise' && file.context_id != exercise.id
file.nil? || file.hidden || file.read_only || file.context_type == 'Exercise' && file.context_id != exercise.id
end
else
[]

View File

@ -24,7 +24,8 @@ describe FileParameters do
end
it 'new file' do
new_file = FactoryBot.create(:file, context: hello_world)
submission = FactoryBot.create(:submission, exercise: hello_world, id: 1337)
new_file = FactoryBot.create(:file, context: submission)
expect(file_accepted?(new_file)).to be true
end
end