Fix Rubocop offenses

This commit is contained in:
Sebastian Serth
2023-06-11 20:46:45 +02:00
parent 5a10e04121
commit bcdc71021e
19 changed files with 39 additions and 39 deletions

View File

@ -6,15 +6,15 @@ module CodeOcean
FactoryBot.define do
factory :file, class: 'CodeOcean::File' do
content { '' }
association :context, factory: :submission
association :file_type, factory: :dot_rb
context factory: :submission
file_type factory: :dot_rb
hidden { false }
name { SecureRandom.hex }
read_only { false }
role { 'main_file' }
trait(:image) do
association :file_type, factory: :dot_png
file_type factory: :dot_png
name { 'poster' }
native_file { Rack::Test::UploadedFile.new(Rails.root.join('db/seeds/audio_video/poster.png'), 'image/png') }
end
@ -22,8 +22,8 @@ module CodeOcean
factory :test_file, class: 'CodeOcean::File' do
content { '' }
association :context, factory: :dummy
association :file_type, factory: :dot_rb
context factory: :dummy
file_type factory: :dot_rb
hidden { true }
name { SecureRandom.hex }
read_only { true }

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :codeharbor_link do
user { build(:teacher) }
user factory: :teacher
push_url { 'https://push.url' }
check_uuid_url { 'https://check-uuid.url' }
sequence(:api_key) {|n| "api_key#{n}" }

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :error_template do
association :execution_environment, factory: :ruby
execution_environment factory: :ruby
name { 'MyString' }
signature { 'MyString' }
end

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :external_user do
association :consumer
consumer
generated_email
external_id { SecureRandom.uuid }
generated_user_name

View File

@ -3,7 +3,7 @@
FactoryBot.define do
factory :admin, class: 'InternalUser' do
activated_user
association :consumer
consumer
email { 'admin@example.org' }
generated_user_name
password { 'admin' }
@ -17,7 +17,7 @@ FactoryBot.define do
factory :teacher, class: 'InternalUser' do
activated_user
association :consumer
consumer
generated_email
generated_user_name
password { 'teacher' }
@ -31,7 +31,7 @@ FactoryBot.define do
factory :learner, class: 'InternalUser' do
activated_user
association :consumer
consumer
generated_email
generated_user_name
password { 'learner' }

View File

@ -8,9 +8,9 @@ FactoryBot.define do
}.freeze
factory :lti_parameter do
association :consumer
association :exercise, factory: :math
association :external_user
consumer
exercise factory: :math
external_user
lti_parameters { lti_params }

View File

@ -2,10 +2,10 @@
FactoryBot.define do
factory :rfc, class: 'RequestForComment' do
association :user, factory: :external_user
association :exercise, factory: :math
user factory: :external_user
exercise factory: :math
submission { association :submission, exercise:, user: }
association :file
file
sequence :question do |n|
"test question #{n}"
end

View File

@ -4,7 +4,7 @@
FactoryBot.define do
factory :runner do
runner_id { SecureRandom.uuid }
association :execution_environment, factory: :ruby
association :user, factory: :external_user
execution_environment factory: :ruby
user factory: :external_user
end
end

View File

@ -3,7 +3,7 @@
FactoryBot.define do
%i[admin external_user teacher].each do |factory_name|
trait :"created_by_#{factory_name}" do
association :user, factory: factory_name
user factory: factory_name
end
end

View File

@ -2,8 +2,8 @@
FactoryBot.define do
factory :structured_error_attribute do
association :structured_error
association :error_template_attribute
structured_error
error_template_attribute
value { 'MyString' }
end
end

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :structured_error do
association :error_template
association :submission
error_template
submission
end
end

View File

@ -2,7 +2,7 @@
FactoryBot.define do
factory :study_group, class: 'StudyGroup' do
association :consumer
consumer
sequence :name do |n|
"TestGroup#{n}"
end

View File

@ -4,7 +4,7 @@ FactoryBot.define do
factory :submission do
cause { 'save' }
created_by_external_user
association :exercise, factory: :math
exercise factory: :math
after(:create) do |submission|
submission.exercise.files.editable.visible.each do |file|

View File

@ -4,6 +4,6 @@ FactoryBot.define do
factory :user_exercise_feedback, class: 'UserExerciseFeedback' do
created_by_external_user
feedback_text { 'Most suitable exercise ever' }
association :exercise, factory: :math
exercise factory: :math
end
end