Fix submission scoring during specs

This commit is contained in:
Sebastian Serth
2021-08-17 12:45:26 +02:00
parent 47888f1dbd
commit a0ca15c6ac
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,10 @@ describe SubmissionScoring do
let(:controller) { Controller.new }
let(:submission) { FactoryBot.create(:submission, cause: 'submit') }
before { controller.instance_variable_set(:@current_user, FactoryBot.create(:external_user)) }
before do
controller.instance_variable_set(:@current_user, FactoryBot.create(:external_user))
controller.instance_variable_set(:@_params, {})
end
describe '#collect_test_results' do
after { controller.send(:collect_test_results, submission) }
@ -22,7 +25,7 @@ describe SubmissionScoring do
end
end
describe '#score_submission' do
describe '#score_submission', cleaning_strategy: :truncation do
after { controller.score_submission(submission) }
it 'collects the test results' do

View File

@ -22,8 +22,8 @@ RSpec.configure do |config|
DatabaseCleaner.clean_with(:truncation)
end
config.before do
DatabaseCleaner.strategy = :transaction
config.before do |example|
DatabaseCleaner.strategy = example.metadata[:cleaning_strategy] || :transaction
end
config.before(:each, type: :feature) do