Fix Rubocop offenses
This commit is contained in:
@ -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 }
|
||||
|
@ -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}" }
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :external_user do
|
||||
association :consumer
|
||||
consumer
|
||||
generated_email
|
||||
external_id { SecureRandom.uuid }
|
||||
generated_user_name
|
||||
|
@ -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' }
|
||||
|
@ -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 }
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :structured_error do
|
||||
association :error_template
|
||||
association :submission
|
||||
error_template
|
||||
submission
|
||||
end
|
||||
end
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
FactoryBot.define do
|
||||
factory :study_group, class: 'StudyGroup' do
|
||||
association :consumer
|
||||
consumer
|
||||
sequence :name do |n|
|
||||
"TestGroup#{n}"
|
||||
end
|
||||
|
@ -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|
|
||||
|
@ -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
|
||||
|
@ -184,7 +184,7 @@ describe RequestForCommentPolicy do
|
||||
end
|
||||
|
||||
it 'does not grant access to authors of another primary study groups' do
|
||||
rfc_other_study_group.author.update(study_groups: [create(:study_group)])
|
||||
rfc_other_study_group.author.update(study_groups: create_list(:study_group, 1))
|
||||
expect(policy).not_to permit(rfc_other_study_group.author, rfc_other_study_group)
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user