Fix rubocop offenses - Requires Ruby 3.1+
This commit is contained in:
@ -7,7 +7,7 @@ describe Exercise do
|
||||
let(:users) { create_list(:external_user, 10) }
|
||||
|
||||
def create_submissions
|
||||
create_list(:submission, 10, cause: 'submit', exercise: exercise, score: Forgery(:basic).number, user: users.sample)
|
||||
create_list(:submission, 10, cause: 'submit', exercise:, score: Forgery(:basic).number, user: users.sample)
|
||||
end
|
||||
|
||||
it 'validates the number of main files' do
|
||||
@ -113,7 +113,7 @@ describe Exercise do
|
||||
|
||||
it 'overwrites the supplied attributes' do
|
||||
title = Forgery(:basic).text
|
||||
expect(exercise.duplicate(title: title).title).to eq(title)
|
||||
expect(exercise.duplicate(title:).title).to eq(title)
|
||||
end
|
||||
|
||||
it 'duplicates all associated files' do
|
||||
|
@ -24,7 +24,7 @@ describe InternalUser do
|
||||
end
|
||||
|
||||
it 'validates the confirmation of the password' do
|
||||
user.update(password: password, password_confirmation: '')
|
||||
user.update(password:, password_confirmation: '')
|
||||
expect(user.errors[:password_confirmation]).to be_present
|
||||
end
|
||||
|
||||
@ -40,7 +40,7 @@ describe InternalUser do
|
||||
before { user.deliver_reset_password_instructions! }
|
||||
|
||||
it 'validates the confirmation of the password' do
|
||||
user.update(password: password, password_confirmation: '')
|
||||
user.update(password:, password_confirmation: '')
|
||||
expect(user.errors[:password_confirmation]).to be_present
|
||||
end
|
||||
|
||||
@ -54,7 +54,7 @@ describe InternalUser do
|
||||
let(:user) { create(:teacher, activation_state: 'active') }
|
||||
|
||||
it 'does not validate the confirmation of the password' do
|
||||
user.update(password: password, password_confirmation: '')
|
||||
user.update(password:, password_confirmation: '')
|
||||
expect(user.errors[:password_confirmation]).not_to be_present
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe Runner do
|
||||
describe '::strategy_class' do
|
||||
shared_examples 'uses the strategy defined in the constant' do |strategy, strategy_class|
|
||||
let(:codeocean_config) { instance_double(CodeOcean::Config) }
|
||||
let(:runner_management_config) { {runner_management: {enabled: true, strategy: strategy}} }
|
||||
let(:runner_management_config) { {runner_management: {enabled: true, strategy:}} }
|
||||
|
||||
before do
|
||||
# Ensure to reset the memorized helper
|
||||
@ -166,7 +166,7 @@ describe Runner do
|
||||
describe 'creation' do
|
||||
let(:user) { create(:external_user) }
|
||||
let(:execution_environment) { create(:ruby) }
|
||||
let(:create_action) { -> { described_class.create(user: user, execution_environment: execution_environment) } }
|
||||
let(:create_action) { -> { described_class.create(user:, execution_environment:) } }
|
||||
|
||||
it 'requests a runner id from the runner management' do
|
||||
expect(strategy_class).to receive(:request_from_management)
|
||||
@ -254,7 +254,7 @@ describe Runner do
|
||||
end
|
||||
|
||||
context 'when a runner already exists' do
|
||||
let!(:existing_runner) { create(:runner, user: user, execution_environment: exercise.execution_environment) }
|
||||
let!(:existing_runner) { create(:runner, user:, execution_environment: exercise.execution_environment) }
|
||||
|
||||
it 'returns the existing runner' do
|
||||
new_runner = described_class.for(user, exercise.execution_environment)
|
||||
|
@ -67,7 +67,7 @@ describe Submission do
|
||||
end
|
||||
|
||||
describe '#siblings' do
|
||||
let(:siblings) { described_class.find_by(user: user).siblings }
|
||||
let(:siblings) { described_class.find_by(user:).siblings }
|
||||
let(:user) { create(:external_user) }
|
||||
|
||||
before do
|
||||
@ -93,7 +93,7 @@ describe Submission do
|
||||
context 'with no exercise feedback' do
|
||||
let(:exercise) { create(:dummy) }
|
||||
let(:user) { build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) % 10) }
|
||||
let(:submission) { build(:submission, exercise: exercise, user: user) }
|
||||
let(:submission) { build(:submission, exercise:, user:) }
|
||||
|
||||
it 'sends 10% of users to feedback page' do
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_truthy
|
||||
@ -101,7 +101,7 @@ describe Submission do
|
||||
|
||||
it 'does not redirect other users' do
|
||||
9.times do |i|
|
||||
submission = build(:submission, exercise: exercise, user: build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) - i - 1))
|
||||
submission = build(:submission, exercise:, user: build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) - i - 1))
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_falsey
|
||||
end
|
||||
end
|
||||
@ -110,7 +110,7 @@ describe Submission do
|
||||
context 'with little exercise feedback' do
|
||||
let(:exercise) { create(:dummy_with_user_feedbacks) }
|
||||
let(:user) { build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) % 10) }
|
||||
let(:submission) { build(:submission, exercise: exercise, user: user) }
|
||||
let(:submission) { build(:submission, exercise:, user:) }
|
||||
|
||||
it 'sends 10% of users to feedback page' do
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_truthy
|
||||
@ -118,7 +118,7 @@ describe Submission do
|
||||
|
||||
it 'does not redirect other users' do
|
||||
9.times do |i|
|
||||
submission = build(:submission, exercise: exercise, user: build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) - i - 1))
|
||||
submission = build(:submission, exercise:, user: build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) - i - 1))
|
||||
expect(submission.send(:redirect_to_feedback?)).to be_falsey
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user