Move submission scoring from controller concern to submission model

Localization and markdown formatting is now done in a controller
spec in order to bring this logic away from the data and towards
the view.
This commit is contained in:
Felix Auringer
2021-06-11 12:01:16 +02:00
committed by Sebastian Serth
parent b847daf823
commit b6bc578aea
10 changed files with 188 additions and 143 deletions

View File

@ -6,7 +6,7 @@ describe 'Editor', js: true do
let(:exercise) { FactoryBot.create(:audio_video, description: Forgery(:lorem_ipsum).sentence) }
let(:scoring_response) do
[{
status: 'ok',
status: :ok,
stdout: '',
stderr: '',
waiting_for_container_time: 0,
@ -95,7 +95,7 @@ describe 'Editor', js: true do
it 'contains a button for submitting the exercise' do
submission = FactoryBot.build(:submission, user: user, exercise: exercise)
allow(submission).to receive(:calculate_score).and_return(JSON.dump(scoring_response))
allow(submission).to receive(:calculate_score).and_return(scoring_response)
allow(Submission).to receive(:find).and_return(submission)
click_button(I18n.t('exercises.editor.score'))
expect(page).not_to have_css('#submit_outdated')