Fix rubocop offenses

This commit is contained in:
Sebastian Serth
2021-10-05 12:09:56 +02:00
parent 2c0a9fda8d
commit 74e285e9fd
11 changed files with 16 additions and 14 deletions

View File

@ -93,7 +93,7 @@ describe Submission do
describe '#redirect_to_feedback?' do
context 'with no exercise feedback' do
let(:exercise) { FactoryBot.create(:dummy) }
let(:user) { FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) % 10) }
let(:user) { FactoryBot.build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) % 10) }
let(:submission) { FactoryBot.build(:submission, exercise: exercise, user: user) }
it 'sends 10% of users to feedback page' do
@ -102,7 +102,7 @@ describe Submission do
it 'does not redirect other users' do
9.times do |i|
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.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) { FactoryBot.create(:dummy_with_user_feedbacks) }
let(:user) { FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) % 10) }
let(:user) { FactoryBot.build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) % 10) }
let(:submission) { FactoryBot.build(:submission, exercise: exercise, user: user) }
it 'sends 10% of users to feedback page' do
@ -119,7 +119,7 @@ describe Submission do
it 'does not redirect other users' do
9.times do |i|
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.build(:external_user, id: (11 - exercise.created_at.to_i % 10) - i - 1))
submission = FactoryBot.build(:submission, exercise: exercise, user: FactoryBot.build(:external_user, id: (11 - (exercise.created_at.to_i % 10)) - i - 1))
expect(submission.send(:redirect_to_feedback?)).to be_falsey
end
end

View File

@ -118,7 +118,7 @@ describe ProformaService::ConvertTaskToExercise do
end
context 'when file is very large' do
let(:content) { 'test' * 10**5 }
let(:content) { 'test' * (10**5) }
it 'creates an exercise with a file that has the correct attributes' do
expect(convert_to_exercise_service.files.first).to have_attributes(content: content)

View File

@ -83,7 +83,7 @@ describe ProformaService::Import do
it { is_expected.to be_an_equal_exercise_as exercise }
context 'when the mainfile is very large' do
let(:file) { FactoryBot.build(:file, content: 'test' * 10**5) }
let(:file) { FactoryBot.build(:file, content: 'test' * (10**5)) }
it { is_expected.to be_an_equal_exercise_as exercise }
end