Fix rubocop offenses - Requires Ruby 3.1+

This commit is contained in:
Sebastian Serth
2022-11-25 10:53:14 +01:00
parent bdf474e684
commit 574e99eddd
93 changed files with 315 additions and 315 deletions

View File

@ -56,7 +56,7 @@ describe Lti do
it 'returns to the tool consumer' do
message = I18n.t('sessions.oauth.invalid_consumer')
expect(controller).to receive(:return_to_consumer).with(lti_errorlog: message, lti_errormsg: I18n.t('sessions.oauth.failure'))
controller.send(:refuse_lti_launch, message: message)
controller.send(:refuse_lti_launch, message:)
end
end
@ -174,14 +174,14 @@ describe Lti do
controller.instance_variable_set(:@exercise, create(:fibonacci))
expect(controller.session).to receive(:[]=).with(:external_user_id, anything)
expect(controller.session).to receive(:[]=).with(:lti_parameters_id, anything)
controller.send(:store_lti_session_data, consumer: build(:consumer), parameters: parameters)
controller.send(:store_lti_session_data, consumer: build(:consumer), parameters:)
end
it 'creates an LtiParameter Object' do
before_count = LtiParameter.count
controller.instance_variable_set(:@current_user, create(:external_user))
controller.instance_variable_set(:@exercise, create(:fibonacci))
controller.send(:store_lti_session_data, consumer: build(:consumer), parameters: parameters)
controller.send(:store_lti_session_data, consumer: build(:consumer), parameters:)
expect(LtiParameter.count).to eq(before_count + 1)
end
end

View File

@ -76,7 +76,7 @@ describe ApplicationController do
context "when using the 'locale' parameter" do
it 'overwrites the session' do
expect(session).to receive(:[]=).with(:locale, locale)
get :welcome, params: {locale: locale}
get :welcome, params: {locale:}
end
end
end

View File

@ -30,7 +30,7 @@ describe CodeOcean::FilesController do
end
describe 'POST #create' do
let(:submission) { create(:submission, user: user) }
let(:submission) { create(:submission, user:) }
context 'with a valid file' do
let(:perform_request) { proc { post :create, params: {code_ocean_file: build(:file, context: submission).attributes, format: :json} } }

View File

@ -22,7 +22,7 @@ describe CodeharborLinksController do
end
describe 'GET #edit' do
let(:codeharbor_link) { create(:codeharbor_link, user: user) }
let(:codeharbor_link) { create(:codeharbor_link, user:) }
before { get :edit, params: {id: codeharbor_link.id} }
@ -56,7 +56,7 @@ describe CodeharborLinksController do
end
describe 'PUT #update' do
let(:codeharbor_link) { create(:codeharbor_link, user: user) }
let(:codeharbor_link) { create(:codeharbor_link, user:) }
let(:put_request) { patch :update, params: {id: codeharbor_link.id, codeharbor_link: params} }
let(:params) { {push_url: 'https://foo.bar/push', check_uuid_url: 'https://foo.bar/check', api_key: 'api_key'} }
@ -91,7 +91,7 @@ describe CodeharborLinksController do
end
describe 'DELETE #destroy' do
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
let!(:codeharbor_link) { create(:codeharbor_link, user:) }
let(:destroy_request) { delete :destroy, params: {id: codeharbor_link.id} }
it 'deletes codeharbor_link' do

View File

@ -6,7 +6,7 @@ describe CommentsController do
render_views
let(:user) { create(:learner) }
let(:rfc_with_comment) { create(:rfc_with_comment, user: user) }
let(:rfc_with_comment) { create(:rfc_with_comment, user:) }
let(:comment) { rfc_with_comment.comments.first }
let(:updated_comment) { comment.reload }
let(:perform_request) { proc { put :update, format: :json, params: {id: comment.id, comment: comment_params} } }

View File

@ -95,7 +95,7 @@ describe ExecutionEnvironmentsController do
runner = instance_double Runner
allow(Runner).to receive(:for).with(user, execution_environment).and_return runner
allow(runner).to receive(:execute_command).and_return({})
post :execute_command, params: {command: command, id: execution_environment.id}
post :execute_command, params: {command:, id: execution_environment.id}
end
expect_assigns(execution_environment: :execution_environment)

View File

@ -37,7 +37,7 @@ describe ExercisesController do
expect_assigns(exercise: Exercise)
it 'clones the exercise' do
expect_any_instance_of(Exercise).to receive(:duplicate).with(hash_including(public: false, user: user)).and_call_original
expect_any_instance_of(Exercise).to receive(:duplicate).with(hash_including(public: false, user:)).and_call_original
expect { perform_request.call }.to change(Exercise, :count).by(1)
end
@ -78,7 +78,7 @@ describe ExercisesController do
end
context 'when including a file' do
let(:perform_request) { proc { post :create, params: {exercise: exercise_attributes.merge(files_attributes: files_attributes)} } }
let(:perform_request) { proc { post :create, params: {exercise: exercise_attributes.merge(files_attributes:)} } }
context 'when specifying the file content within the form' do
let(:files_attributes) { {'0' => build(:file).attributes} }
@ -89,7 +89,7 @@ describe ExercisesController do
end
context 'when uploading a file' do
let(:files_attributes) { {'0' => build(:file, file_type: file_type).attributes.merge(content: uploaded_file)} }
let(:files_attributes) { {'0' => build(:file, file_type:).attributes.merge(content: uploaded_file)} }
context 'when uploading a binary file' do
let(:file_path) { Rails.root.join('db/seeds/audio_video/devstories.mp4') }
@ -255,14 +255,14 @@ describe ExercisesController do
end
describe 'GET #external_user_statistics' do
let(:perform_request) { get :external_user_statistics, params: params }
let(:perform_request) { get :external_user_statistics, params: }
let(:params) { {id: exercise.id, external_user_id: external_user.id} }
let(:external_user) { create(:external_user) }
before do
2.times { create(:submission, cause: 'autosave', user: external_user, exercise: exercise) }
2.times { create(:submission, cause: 'run', user: external_user, exercise: exercise) }
create(:submission, cause: 'assess', user: external_user, exercise: exercise)
2.times { create(:submission, cause: 'autosave', user: external_user, exercise:) }
2.times { create(:submission, cause: 'run', user: external_user, exercise:) }
create(:submission, cause: 'assess', user: external_user, exercise:)
end
context 'when viewing the default submission statistics page without a parameter' do
@ -312,8 +312,8 @@ describe ExercisesController do
end
before do
create(:lti_parameter, external_user: user, exercise: exercise)
submission = build(:submission, exercise: exercise, user: user)
create(:lti_parameter, external_user: user, exercise:)
submission = build(:submission, exercise:, user:)
allow(submission).to receive(:normalized_score).and_return(1)
allow(submission).to receive(:calculate_score).and_return(scoring_response)
allow(Submission).to receive(:create).and_return(submission)
@ -404,13 +404,13 @@ describe ExercisesController do
render_views
let(:post_request) { post :export_external_check, params: {id: exercise.id} }
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
let(:external_check_hash) { {message: message, uuid_found: true, update_right: update_right, error: error} }
let!(:codeharbor_link) { create(:codeharbor_link, user:) }
let(:external_check_hash) { {message:, uuid_found: true, update_right:, error:} }
let(:message) { 'message' }
let(:update_right) { true }
let(:error) { nil }
before { allow(ExerciseService::CheckExternal).to receive(:call).with(uuid: exercise.uuid, codeharbor_link: codeharbor_link).and_return(external_check_hash) }
before { allow(ExerciseService::CheckExternal).to receive(:call).with(uuid: exercise.uuid, codeharbor_link:).and_return(external_check_hash) }
it 'renders the correct contents as json' do
post_request
@ -457,14 +457,14 @@ describe ExercisesController do
describe 'POST #export_external_confirm' do
render_views
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
let!(:codeharbor_link) { create(:codeharbor_link, user:) }
let(:post_request) { post :export_external_confirm, params: {id: exercise.id, codeharbor_link: codeharbor_link.id} }
let(:error) { nil }
let(:zip) { 'zip' }
before do
allow(ProformaService::ExportTask).to receive(:call).with(exercise: exercise).and_return(zip)
allow(ExerciseService::PushExternal).to receive(:call).with(zip: zip, codeharbor_link: codeharbor_link).and_return(error)
allow(ProformaService::ExportTask).to receive(:call).with(exercise:).and_return(zip)
allow(ExerciseService::PushExternal).to receive(:call).with(zip:, codeharbor_link:).and_return(error)
end
it 'renders correct response' do
@ -493,9 +493,9 @@ describe ExercisesController do
describe 'POST #import_uuid_check' do
let(:exercise) { create(:dummy, uuid: SecureRandom.uuid) }
let!(:codeharbor_link) { create(:codeharbor_link, user: user) }
let!(:codeharbor_link) { create(:codeharbor_link, user:) }
let(:uuid) { exercise.reload.uuid }
let(:post_request) { post :import_uuid_check, params: {uuid: uuid} }
let(:post_request) { post :import_uuid_check, params: {uuid:} }
let(:headers) { {'Authorization' => "Bearer #{codeharbor_link.api_key}"} }
before { request.headers.merge! headers }
@ -542,7 +542,7 @@ describe ExercisesController do
end
describe 'POST #import_task' do
let(:codeharbor_link) { create(:codeharbor_link, user: user) }
let(:codeharbor_link) { create(:codeharbor_link, user:) }
let!(:imported_exercise) { create(:fibonacci) }
let(:post_request) { post :import_task, body: zip_file_content }
let(:zip_file_content) { 'zipped task xml' }
@ -560,7 +560,7 @@ describe ExercisesController do
it 'calls service' do
post_request
expect(ProformaService::Import).to have_received(:call).with(zip: be_a(Tempfile).and(has_content(zip_file_content)), user: user)
expect(ProformaService::Import).to have_received(:call).with(zip: be_a(Tempfile).and(has_content(zip_file_content)), user:)
end
context 'when import fails with ProformaError' do

View File

@ -61,7 +61,7 @@ describe InternalUsersController do
context 'with an already activated user' do
before do
user.activate!
put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password: password, password_confirmation: password}}
put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password:, password_confirmation: password}}
end
expect_redirect(:root)
@ -80,7 +80,7 @@ describe InternalUsersController do
end
context 'without a valid password confirmation' do
before { put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password: password, password_confirmation: ''}} }
before { put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password:, password_confirmation: ''}} }
expect_assigns(user: InternalUser)
@ -92,7 +92,7 @@ describe InternalUsersController do
end
context 'with valid preconditions' do
before { put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password: password, password_confirmation: password}} }
before { put :activate, params: {id: user.id, internal_user: {activation_token: user.activation_token, password:, password_confirmation: password}} }
expect_assigns(user: InternalUser)
@ -278,7 +278,7 @@ describe InternalUsersController do
let(:password) { 'foo' }
context 'with a matching password confirmation' do
let(:perform_request) { proc { put :reset_password, params: {internal_user: {password: password, password_confirmation: password}, id: user.id, token: user.reset_password_token} } }
let(:perform_request) { proc { put :reset_password, params: {internal_user: {password:, password_confirmation: password}, id: user.id, token: user.reset_password_token} } }
before { perform_request.call }
@ -310,7 +310,7 @@ describe InternalUsersController do
context 'without a matching password confirmation' do
before do
put :reset_password, params: {internal_user: {password: password, password_confirmation: ''}, id: user.id, token: user.reset_password_token}
put :reset_password, params: {internal_user: {password:, password_confirmation: ''}, id: user.id, token: user.reset_password_token}
end
expect_assigns(user: :user)

View File

@ -19,7 +19,7 @@ describe RequestForCommentsController do
it 'shows only rfc`s belonging to selected study group' do
my_study_group = create(:study_group)
rfc_within_my_study_group = create(:rfc, user: user)
rfc_within_my_study_group = create(:rfc, user:)
user.update(study_groups: [my_study_group])
rfc_within_my_study_group.submission.update(study_group: my_study_group)

View File

@ -9,13 +9,13 @@ describe SessionsController do
describe 'POST #create' do
let(:password) { attributes_for(:teacher)[:password] }
let(:user) { InternalUser.create(user_attributes.merge(password: password)) }
let(:user) { InternalUser.create(user_attributes.merge(password:)) }
let(:user_attributes) { build(:teacher).attributes }
context 'with valid credentials' do
before do
user.activate!
post :create, params: {email: user.email, password: password, remember_me: 1}
post :create, params: {email: user.email, password:, remember_me: 1}
end
expect_flash_message(:notice, :'sessions.create.success')
@ -113,7 +113,7 @@ describe SessionsController do
context 'when LTI outcomes are supported' do
# The expected message should be localized in the requested localization
let(:message) { I18n.t('sessions.create_through_lti.session_with_outcome', consumer: consumer, locale: locale) }
let(:message) { I18n.t('sessions.create_through_lti.session_with_outcome', consumer:, locale:) }
before do
allow(controller).to receive(:lti_outcome_service?).and_return(true)
@ -125,7 +125,7 @@ describe SessionsController do
context 'when LTI outcomes are not supported' do
# The expected message should be localized in the requested localization
let(:message) { I18n.t('sessions.create_through_lti.session_without_outcome', consumer: consumer, locale: locale) }
let(:message) { I18n.t('sessions.create_through_lti.session_without_outcome', consumer:, locale:) }
before do
allow(controller).to receive(:lti_outcome_service?).and_return(false)

View File

@ -116,7 +116,7 @@ describe SubmissionsController do
context 'with an invalid filename' do
let(:filename) { SecureRandom.hex }
before { get :render_file, params: {filename: filename, id: submission.id, token: token} }
before { get :render_file, params: {filename:, id: submission.id, token:} }
expect_http_status(:not_found)
end
@ -125,7 +125,7 @@ describe SubmissionsController do
let(:submission) { create(:submission, exercise: create(:audio_video)) }
let(:filename) { file.name_with_extension }
before { get :render_file, params: {filename: filename, id: submission.id, token: token} }
before { get :render_file, params: {filename:, id: submission.id, token:} }
context 'with a binary file' do
let(:file) { submission.collect_files.detect {|file| file.file_type.file_extension == '.mp4' } }

View File

@ -8,7 +8,7 @@ FactoryBot.define do
trait :singleton_consumer do
initialize_with do
Consumer.find_or_initialize_by(name: name) do |consumer|
Consumer.find_or_initialize_by(name:) do |consumer|
consumer.oauth_key = SecureRandom.hex
consumer.oauth_secret = SecureRandom.hex
end

View File

@ -6,7 +6,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-coffee:latest' }
file_type { association :dot_coffee, user: user }
file_type { association :dot_coffee, user: }
help
name { 'CoffeeScript' }
network_enabled { false }
@ -22,7 +22,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-html:latest' }
file_type { association :dot_html, user: user }
file_type { association :dot_html, user: }
help
name { 'HTML5' }
network_enabled { false }
@ -40,7 +40,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'openhpi/co_execenv_java:8-antlr' }
file_type { association :dot_java, user: user }
file_type { association :dot_java, user: }
help
name { 'Java 8' }
network_enabled { false }
@ -58,7 +58,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-jruby:latest' }
file_type { association :dot_rb, user: user }
file_type { association :dot_rb, user: }
help
name { 'JRuby 1.7' }
network_enabled { false }
@ -76,7 +76,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-node:latest' }
file_type { association :dot_js, user: user }
file_type { association :dot_js, user: }
help
name { 'Node.js' }
network_enabled { false }
@ -92,7 +92,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'openhpi/co_execenv_python:3.4' }
file_type { association :dot_py, user: user }
file_type { association :dot_py, user: }
help
name { 'Python 3.4' }
network_enabled { false }
@ -110,7 +110,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-ruby:latest' }
file_type { association :dot_rb, user: user }
file_type { association :dot_rb, user: }
help
name { 'Ruby 2.2' }
network_enabled { false }
@ -128,7 +128,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-sinatra:latest' }
file_type { association :dot_rb, user: user }
file_type { association :dot_rb, user: }
exposed_ports { [4567] }
help
name { 'Sinatra' }
@ -147,7 +147,7 @@ FactoryBot.define do
default_memory_limit
default_cpu_limit
docker_image { 'hklement/ubuntu-sqlite:latest' }
file_type { association :dot_sql, user: user }
file_type { association :dot_sql, user: }
help
name { 'SQLite' }
network_enabled { false }
@ -173,6 +173,6 @@ FactoryBot.define do
end
trait :singleton_execution_environment do
initialize_with { ExecutionEnvironment.where(name: name).first_or_create }
initialize_with { ExecutionEnvironment.where(name:).first_or_create }
end
end

View File

@ -9,7 +9,7 @@ def create_seed_file(exercise, path, file_attributes = {})
user: exercise.user
)
name = File.basename(path).gsub(file_extension, '')
file_attributes.merge!(file_type: file_type, name: name, path: path.split('/')[1..-2].join('/'), role: file_attributes[:role] || 'regular_file')
file_attributes.merge!(file_type:, name:, path: path.split('/')[1..-2].join('/'), role: file_attributes[:role] || 'regular_file')
if file_type.binary?
file_attributes[:native_file] = File.open(SeedsHelper.seed_file_path(path), 'r')
else
@ -22,7 +22,7 @@ FactoryBot.define do
factory :audio_video, class: 'Exercise' do
created_by_teacher
description { "Try HTML's audio and video capabilities." }
execution_environment { association :html, user: user }
execution_environment { association :html, user: }
instructions { 'Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4.' }
title { 'Audio & Video' }
@ -40,7 +40,7 @@ FactoryBot.define do
factory :dummy, class: 'Exercise' do
created_by_teacher
description { 'Dummy' }
execution_environment { association :ruby, user: user }
execution_environment { association :ruby, user: }
instructions
title { 'Dummy' }
@ -56,7 +56,7 @@ FactoryBot.define do
# attributes; `create_list`'s second argument is the number of records
# to create and we make sure the user_exercise_feedback is associated properly to the exercise
after(:create) do |exercise, evaluator|
create_list(:user_exercise_feedback, evaluator.user_feedbacks_count, exercise: exercise)
create_list(:user_exercise_feedback, evaluator.user_feedbacks_count, exercise:)
end
end
end
@ -64,7 +64,7 @@ FactoryBot.define do
factory :even_odd, class: 'Exercise' do
created_by_teacher
description { 'Implement two methods even and odd which return whether a given number is even or odd, respectively.' }
execution_environment { association :python, user: user }
execution_environment { association :python, user: }
instructions
title { 'Even/Odd' }
@ -78,7 +78,7 @@ FactoryBot.define do
factory :fibonacci, class: 'Exercise' do
created_by_teacher
description { 'Implement a recursive function that calculates a requested Fibonacci number.' }
execution_environment { association :ruby, user: user }
execution_environment { association :ruby, user: }
instructions
title { 'Fibonacci Sequence' }
@ -94,7 +94,7 @@ FactoryBot.define do
factory :files, class: 'Exercise' do
created_by_teacher
description { 'Learn how to work with files.' }
execution_environment { association :ruby, user: user }
execution_environment { association :ruby, user: }
instructions
title { 'Working with Files' }
@ -108,7 +108,7 @@ FactoryBot.define do
factory :geolocation, class: 'Exercise' do
created_by_teacher
description { "Use the HTML5 Geolocation API to get the user's geographical position." }
execution_environment { association :html, user: user }
execution_environment { association :html, user: }
instructions
title { 'Geolocation' }
@ -121,7 +121,7 @@ FactoryBot.define do
factory :hello_world, class: 'Exercise' do
created_by_teacher
description { "Write a simple 'Hello World' application." }
execution_environment { association :ruby, user: user }
execution_environment { association :ruby, user: }
instructions
title { 'Hello World' }
@ -134,7 +134,7 @@ FactoryBot.define do
factory :math, class: 'Exercise' do
created_by_teacher
description { 'Implement a recursive math library.' }
execution_environment { association :java, user: user }
execution_environment { association :java, user: }
instructions
title { 'Math' }
@ -149,7 +149,7 @@ FactoryBot.define do
factory :primes, class: 'Exercise' do
created_by_teacher
description { 'Write a function that prints the first n prime numbers.' }
execution_environment { association :node_js, user: user }
execution_environment { association :node_js, user: }
instructions
title { 'Primes' }
@ -161,7 +161,7 @@ FactoryBot.define do
factory :sql_select, class: 'Exercise' do
created_by_teacher
description { 'Learn to use the SELECT statement.' }
execution_environment { association :sqlite, user: user }
execution_environment { association :sqlite, user: }
instructions { "Write a query which selects the full rows for all people with the last name 'Doe'." }
title { 'SELECT' }
@ -175,7 +175,7 @@ FactoryBot.define do
factory :tdd, class: 'Exercise' do
created_by_teacher
description { 'Learn to appreciate test-driven development.' }
execution_environment { association :ruby, user: user }
execution_environment { association :ruby, user: }
instructions { SeedsHelper.read_seed_file('tdd/instructions.md') }
title { 'Test-driven Development' }
@ -188,7 +188,7 @@ FactoryBot.define do
factory :web_app, class: 'Exercise' do
created_by_teacher
description { 'Build a simple Web application with Sinatra.' }
execution_environment { association :sinatra, user: user }
execution_environment { association :sinatra, user: }
instructions
title { 'A Simple Web Application' }

View File

@ -17,7 +17,7 @@ FactoryBot.define do
[ExternalUser, InternalUser].each do |klass|
trait :"singleton_#{klass.name.underscore}" do
initialize_with { klass.where(email: email).first_or_create }
initialize_with { klass.where(email:).first_or_create }
end
end

View File

@ -34,7 +34,7 @@ describe 'Authentication' do
end
context 'with no authentication token' do
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:rfc_path) { request_for_comment_url(request_for_comment) }
it 'denies access to the request for comment' do
@ -49,7 +49,7 @@ describe 'Authentication' do
context 'with an authentication token' do
let(:user) { create(:learner) }
let(:study_group) { request_for_comment.submission.study_group }
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:commenting_user) { InternalUser.create(attributes_for(:teacher)) }
let(:mail) { UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user) }
let(:rfc_link) { request_for_comment_url(request_for_comment, token: token.shared_secret) }
@ -57,7 +57,7 @@ describe 'Authentication' do
before { allow(AuthenticationToken).to receive(:generate!).with(user, study_group).and_return(token).once }
context 'when the token is valid' do
let(:token) { create(:authentication_token, user: user, study_group: study_group) }
let(:token) { create(:authentication_token, user:, study_group:) }
it 'allows access to the request for comment' do
mail.deliver_now
@ -68,7 +68,7 @@ describe 'Authentication' do
end
context 'with an expired authentication token' do
let(:token) { create(:authentication_token, :invalid, user: user, study_group: study_group) }
let(:token) { create(:authentication_token, :invalid, user:, study_group:) }
it 'denies access to the request for comment' do
mail.deliver_now
@ -81,7 +81,7 @@ describe 'Authentication' do
end
context 'when the authentication token is used to login' do
let(:token) { create(:authentication_token, user: user, study_group: study_group) }
let(:token) { create(:authentication_token, user:, study_group:) }
it 'invalidates the token on login' do
mail.deliver_now
@ -108,14 +108,14 @@ describe 'Authentication' do
end
context 'with an authentication token' do
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:study_group) { request_for_comment.submission.study_group }
let(:commenting_user) { InternalUser.create(attributes_for(:teacher)) }
let(:mail) { UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user) }
let(:rfc_link) { request_for_comment_url(request_for_comment, token: token.shared_secret) }
it 'still invalidates the token on login' do
token = create(:authentication_token, user: user, study_group: study_group)
token = create(:authentication_token, user:, study_group:)
mail = UserMailer.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user)
mail.deliver_now
visit(request_for_comment_url(request_for_comment, token: token.shared_secret))

View File

@ -111,7 +111,7 @@ describe 'Editor', js: true do
end
it 'contains a button for submitting the exercise' do
submission = build(:submission, user: user, exercise: exercise)
submission = build(:submission, user:, exercise:)
allow(submission).to receive(:calculate_score).and_return(scoring_response)
allow(Submission).to receive(:find).and_return(submission)
click_button(I18n.t('exercises.editor.score'))

View File

@ -4,15 +4,15 @@ require 'rails_helper'
describe 'ExternalUserStatistics', js: true do
let(:learner) { create(:external_user) }
let(:exercise) { create(:dummy, user: user) }
let(:exercise) { create(:dummy, user:) }
let(:study_group) { create(:study_group) }
let(:password) { 'password123456' }
before do
2.times { create(:submission, cause: 'autosave', user: learner, exercise: exercise, study_group: study_group) }
2.times { create(:submission, cause: 'run', user: learner, exercise: exercise, study_group: study_group) }
create(:submission, cause: 'assess', user: learner, exercise: exercise, study_group: study_group)
create(:submission, cause: 'submit', user: learner, exercise: exercise, study_group: study_group)
2.times { create(:submission, cause: 'autosave', user: learner, exercise:, study_group:) }
2.times { create(:submission, cause: 'run', user: learner, exercise:, study_group:) }
create(:submission, cause: 'assess', user: learner, exercise:, study_group:)
create(:submission, cause: 'submit', user: learner, exercise:, study_group:)
study_group.external_users << learner
study_group.internal_users << user
@ -27,7 +27,7 @@ describe 'ExternalUserStatistics', js: true do
end
context 'when a admin accesses the page' do
let(:user) { create(:admin, password: password) }
let(:user) { create(:admin, password:) }
it 'does display the option to enable autosaves' do
expect(page).to have_content(I18n.t('exercises.external_users.statistics.toggle_status_on')).or have_content(I18n.t('exercises.external_users.statistics.toggle_status_off'))
@ -35,7 +35,7 @@ describe 'ExternalUserStatistics', js: true do
end
context 'when a teacher accesses the page' do
let(:user) { create(:teacher, password: password) }
let(:user) { create(:teacher, password:) }
it 'does not display the option to enable autosaves' do
expect(page).not_to have_content(I18n.t('exercises.external_users.statistics.toggle_status_on'))

View File

@ -6,7 +6,7 @@ describe Assessor do
let(:assessor) { described_class.new(execution_environment: build(:ruby)) }
describe '#assess' do
let(:assess) { assessor.assess(stdout: stdout) }
let(:assess) { assessor.assess(stdout:) }
let(:stdout) { "Finished in 0.1 seconds (files took 0.1 seconds to load)\n2 examples, 1 failure" }
context 'when an error occurs' do
@ -39,7 +39,7 @@ describe Assessor do
describe '#calculate_score' do
let(:count) { 42 }
let(:passed) { 17 }
let(:test_outcome) { {count: count, passed: passed} }
let(:test_outcome) { {count:, passed:} }
it 'returns the correct score' do
expect(assessor.send(:calculate_score, test_outcome)).to eq(passed.to_f / count)

View File

@ -13,7 +13,7 @@ describe JunitAdapter do
let(:error_matches) { [] }
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed, error_messages: error_matches)
expect(adapter.parse_output(stdout:)).to eq(count:, failed:, error_messages: error_matches)
end
end
@ -22,7 +22,7 @@ describe JunitAdapter do
let(:stdout) { "OK (#{count} tests)" }
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, passed: count)
expect(adapter.parse_output(stdout:)).to eq(count:, passed: count)
end
end
end

View File

@ -10,7 +10,7 @@ describe MochaAdapter do
describe '#parse_output' do
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
expect(adapter.parse_output(stdout:)).to eq(count:, failed:)
end
end
end

View File

@ -11,7 +11,7 @@ describe PyUnitAdapter do
describe '#parse_output' do
it 'returns the correct numbers' do
expect(adapter.parse_output(stderr: stderr)).to eq(count: count, failed: failed, error_messages: error_matches)
expect(adapter.parse_output(stderr:)).to eq(count:, failed:, error_messages: error_matches)
end
end
end

View File

@ -10,7 +10,7 @@ describe RspecAdapter do
describe '#parse_output' do
it 'returns the correct numbers' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
expect(adapter.parse_output(stdout:)).to eq(count:, failed:)
end
end
end

View File

@ -145,7 +145,7 @@ describe Runner::Strategy::Poseidon do
it "returns true on status #{status}" do
faraday_connection = instance_double Faraday::Connection
allow(described_class).to receive(:http_connection).and_return(faraday_connection)
allow(faraday_connection).to receive(:put).and_return(Faraday::Response.new(status: status))
allow(faraday_connection).to receive(:put).and_return(Faraday::Response.new(status:))
expect(action.call).to be_truthy
end
end
@ -154,7 +154,7 @@ describe Runner::Strategy::Poseidon do
it "raises an exception on status #{status}" do
faraday_connection = instance_double Faraday::Connection
allow(described_class).to receive(:http_connection).and_return(faraday_connection)
allow(faraday_connection).to receive(:put).and_return(Faraday::Response.new(status: status))
allow(faraday_connection).to receive(:put).and_return(Faraday::Response.new(status:))
expect { action.call }.to raise_exception Runner::Error::UnexpectedResponse
end
end
@ -248,7 +248,7 @@ describe Runner::Strategy::Poseidon do
.stub_request(:post, "#{described_class.config[:url]}/runners/#{runner_id}/execute")
.with(
body: {
command: command,
command:,
timeLimit: execution_environment.permitted_execution_time,
privilegedExecution: execution_environment.privileged_execution,
},

View File

@ -10,7 +10,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: [1]\nUnexpected tuples: []" }
it 'considers the test as failed' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
expect(adapter.parse_output(stdout:)).to eq(count: 1, failed: 1)
end
end
@ -18,7 +18,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: []\nUnexpected tuples: [1]" }
it 'considers the test as failed' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
expect(adapter.parse_output(stdout:)).to eq(count: 1, failed: 1)
end
end
@ -26,7 +26,7 @@ describe SqlResultSetComparatorAdapter do
let(:stdout) { "Missing tuples: []\nUnexpected tuples: []" }
it 'considers the test as passed' do
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, passed: 1)
expect(adapter.parse_output(stdout:)).to eq(count: 1, passed: 1)
end
end
end

View File

@ -11,19 +11,19 @@ describe TestingFrameworkAdapter do
describe '#augment_output' do
context 'when missing the count of all tests' do
it 'adds the count of all tests' do
expect(adapter.send(:augment_output, failed: failed, passed: passed)).to include(count: count)
expect(adapter.send(:augment_output, failed:, passed:)).to include(count:)
end
end
context 'when missing the count of failed tests' do
it 'adds the count of failed tests' do
expect(adapter.send(:augment_output, count: count, passed: passed)).to include(failed: failed)
expect(adapter.send(:augment_output, count:, passed:)).to include(failed:)
end
end
context 'when missing the count of passed tests' do
it 'adds the count of passed tests' do
expect(adapter.send(:augment_output, count: count, failed: failed)).to include(passed: passed)
expect(adapter.send(:augment_output, count:, failed:)).to include(passed:)
end
end
end
@ -42,7 +42,7 @@ describe TestingFrameworkAdapter do
describe '#test_outcome' do
it 'calls the framework-specific implementation' do
allow(adapter).to receive(:parse_output).and_return(count: count, failed: failed, passed: passed)
allow(adapter).to receive(:parse_output).and_return(count:, failed:, passed:)
expect(adapter).to receive(:parse_output)
adapter.test_outcome('')
end

View File

@ -63,8 +63,8 @@ describe UserMailer do
describe '#got_new_comment' do
let(:user) { create(:learner) }
let(:token) { AuthenticationToken.find_by(user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:token) { AuthenticationToken.find_by(user:) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:commenting_user) { InternalUser.create(attributes_for(:teacher)) }
let(:mail) { described_class.got_new_comment(request_for_comment.comments.first, request_for_comment, commenting_user).deliver_now }
@ -116,9 +116,9 @@ describe UserMailer do
describe '#got_new_comment_for_subscription' do
let(:user) { create(:learner) }
let(:token) { AuthenticationToken.find_by(user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:subscription) { Subscription.create(request_for_comment: request_for_comment, user: user, study_group_id: user.current_study_group_id) }
let(:token) { AuthenticationToken.find_by(user:) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:subscription) { Subscription.create(request_for_comment:, user:, study_group_id: user.current_study_group_id) }
let(:from_user) { InternalUser.create(attributes_for(:teacher)) }
let(:mail) { described_class.got_new_comment_for_subscription(request_for_comment.comments.first, subscription, from_user).deliver_now }
@ -172,7 +172,7 @@ describe UserMailer do
let(:user) { create(:learner) }
let(:receiver) { create(:teacher) }
let(:token) { AuthenticationToken.find_by(user: receiver) }
let(:request_for_comment) { create(:rfc_with_comment, user: user) }
let(:request_for_comment) { create(:rfc_with_comment, user:) }
let(:mail) { described_class.send_thank_you_note(request_for_comment, receiver).deliver_now }
it 'sets the correct sender' do

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -215,7 +215,7 @@ describe ExercisePolicy do
before do
[admin, teacher].each do |user|
[true, false].each do |public|
create(:dummy, public: public, user_id: user.id, user_type: InternalUser.name)
create(:dummy, public:, user_id: user.id, user_type: InternalUser.name)
end
end
end

View File

@ -15,7 +15,7 @@ require 'pundit/rspec'
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
Dir[Rails.root.join('spec/support/**/*.rb')].sort.each {|f| require f }
Dir[Rails.root.join('spec/support/**/*.rb')].each {|f| require f }
# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.

View File

@ -4,7 +4,7 @@ require 'rails_helper'
describe ExerciseService::CheckExternal do
describe '.new' do
subject(:export_service) { described_class.new(uuid: uuid, codeharbor_link: codeharbor_link) }
subject(:export_service) { described_class.new(uuid:, codeharbor_link:) }
let(:uuid) { SecureRandom.uuid }
let(:codeharbor_link) { build(:codeharbor_link) }
@ -19,7 +19,7 @@ describe ExerciseService::CheckExternal do
end
describe '#execute' do
subject(:check_external_service) { described_class.call(uuid: uuid, codeharbor_link: codeharbor_link) }
subject(:check_external_service) { described_class.call(uuid:, codeharbor_link:) }
let(:uuid) { SecureRandom.uuid }
let(:codeharbor_link) { build(:codeharbor_link) }
@ -38,7 +38,7 @@ describe ExerciseService::CheckExternal do
it 'submits the correct body' do
expect(check_external_service).to have_requested(:post, codeharbor_link.check_uuid_url)
.with(body: {uuid: uuid}.to_json)
.with(body: {uuid:}.to_json)
end
context 'when response contains a JSON with expected keys' do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe ExerciseService::PushExternal do
describe '.new' do
subject(:push_external) { described_class.new(zip: zip, codeharbor_link: codeharbor_link) }
subject(:push_external) { described_class.new(zip:, codeharbor_link:) }
let(:zip) { ProformaService::ExportTask.call(exercise: build(:dummy)) }
let(:codeharbor_link) { build(:codeharbor_link) }
@ -19,14 +19,14 @@ RSpec.describe ExerciseService::PushExternal do
end
describe '#execute' do
subject(:push_external) { described_class.call(zip: zip, codeharbor_link: codeharbor_link) }
subject(:push_external) { described_class.call(zip:, codeharbor_link:) }
let(:zip) { ProformaService::ExportTask.call(exercise: build(:dummy)) }
let(:codeharbor_link) { build(:codeharbor_link) }
let(:status) { 200 }
let(:response) { '' }
before { stub_request(:post, codeharbor_link.push_url).to_return(status: status, body: response) }
before { stub_request(:post, codeharbor_link.push_url).to_return(status:, body: response) }
it 'calls the correct url' do
expect(push_external).to have_requested(:post, codeharbor_link.push_url)

View File

@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe ProformaService::ConvertExerciseToTask do
describe '.new' do
subject(:convert_to_task) { described_class.new(exercise: exercise) }
subject(:convert_to_task) { described_class.new(exercise:) }
let(:exercise) { build(:dummy) }
@ -16,10 +16,10 @@ RSpec.describe ProformaService::ConvertExerciseToTask do
describe '#execute' do
subject(:task) { convert_to_task.execute }
let(:convert_to_task) { described_class.new(exercise: exercise) }
let(:convert_to_task) { described_class.new(exercise:) }
let(:exercise) do
create(:dummy,
execution_environment: execution_environment,
execution_environment:,
instructions: 'instruction',
uuid: SecureRandom.uuid,
files: files + tests)
@ -85,7 +85,7 @@ RSpec.describe ProformaService::ConvertExerciseToTask do
context 'when exercise has a regular file' do
let(:files) { [file] }
let(:file) { build(:file, role: 'regular_file', hidden: hidden, read_only: read_only) }
let(:file) { build(:file, role: 'regular_file', hidden:, read_only:) }
let(:hidden) { true }
let(:read_only) { true }

View File

@ -4,7 +4,7 @@ require 'rails_helper'
describe ProformaService::ConvertTaskToExercise do
describe '.new' do
subject(:convert_to_exercise_service) { described_class.new(task: task, user: user, exercise: exercise) }
subject(:convert_to_exercise_service) { described_class.new(task:, user:, exercise:) }
let(:task) { Proforma::Task.new }
let(:user) { build(:teacher) }
@ -24,7 +24,7 @@ describe ProformaService::ConvertTaskToExercise do
end
describe '#execute' do
subject(:convert_to_exercise_service) { described_class.call(task: task, user: user, exercise: exercise) }
subject(:convert_to_exercise_service) { described_class.call(task:, user:, exercise:) }
before { create(:dot_txt) }
@ -36,10 +36,10 @@ describe ProformaService::ConvertTaskToExercise do
uuid: 'uuid',
parent_uuid: 'parent_uuid',
language: 'language',
meta_data: meta_data,
model_solutions: model_solutions,
files: files,
tests: tests
meta_data:,
model_solutions:,
files:,
tests:
)
end
let(:user) { create(:teacher) }
@ -63,7 +63,7 @@ describe ProformaService::ConvertTaskToExercise do
description: 'description',
uuid: be_blank,
unpublished: true,
user: user,
user:,
files: be_empty,
public: false,
hide_file_tree: false,
@ -80,11 +80,11 @@ describe ProformaService::ConvertTaskToExercise do
let(:meta_data) do
{
CodeOcean: {
public: public,
hide_file_tree: hide_file_tree,
allow_file_creation: allow_file_creation,
allow_auto_completion: allow_auto_completion,
expected_difficulty: expected_difficulty,
public:,
hide_file_tree:,
allow_file_creation:,
allow_auto_completion:,
expected_difficulty:,
execution_environment_id: execution_environment&.id,
files: files_meta_data,
},
@ -98,7 +98,7 @@ describe ProformaService::ConvertTaskToExercise do
description: 'description',
uuid: be_blank,
unpublished: true,
user: user,
user:,
files: be_empty,
public: true,
hide_file_tree: true,
@ -125,13 +125,13 @@ describe ProformaService::ConvertTaskToExercise do
let(:file) do
Proforma::TaskFile.new(
id: 'id',
content: content,
filename: filename,
content:,
filename:,
used_by_grader: 'used_by_grader',
visible: 'yes',
usage_by_lms: usage_by_lms,
binary: binary,
mimetype: mimetype
usage_by_lms:,
binary:,
mimetype:
)
end
let(:filename) { "#{path}filename.txt" }
@ -192,7 +192,7 @@ describe ProformaService::ConvertTaskToExercise do
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)
expect(convert_to_exercise_service.files.first).to have_attributes(content:)
end
end

View File

@ -4,7 +4,7 @@ require 'rails_helper'
describe ProformaService::ExportTask do
describe '.new' do
subject(:export_task) { described_class.new(exercise: exercise) }
subject(:export_task) { described_class.new(exercise:) }
let(:exercise) { build(:dummy) }
@ -22,15 +22,15 @@ describe ProformaService::ExportTask do
end
describe '#execute' do
subject(:export_task) { described_class.call(exercise: exercise) }
subject(:export_task) { described_class.call(exercise:) }
let(:task) { Proforma::Task.new }
let(:exercise) { build(:dummy) }
let(:exporter) { instance_double(Proforma::Exporter, perform: 'zip') }
before do
allow(ProformaService::ConvertExerciseToTask).to receive(:call).with(exercise: exercise).and_return(task)
allow(Proforma::Exporter).to receive(:new).with(task: task, custom_namespaces: [{prefix: 'CodeOcean', uri: 'codeocean.openhpi.de'}]).and_return(exporter)
allow(ProformaService::ConvertExerciseToTask).to receive(:call).with(exercise:).and_return(task)
allow(Proforma::Exporter).to receive(:new).with(task:, custom_namespaces: [{prefix: 'CodeOcean', uri: 'codeocean.openhpi.de'}]).and_return(exporter)
end
it do

View File

@ -4,7 +4,7 @@ require 'rails_helper'
describe ProformaService::Import do
describe '.new' do
subject(:import_service) { described_class.new(zip: zip, user: user) }
subject(:import_service) { described_class.new(zip:, user:) }
let(:zip) { Tempfile.new('proforma_test_zip_file') }
let(:user) { build(:teacher) }
@ -27,14 +27,14 @@ describe ProformaService::Import do
let(:exercise) do
create(:dummy,
instructions: 'instruction',
execution_environment: execution_environment,
execution_environment:,
files: files + tests,
hide_file_tree: true,
allow_file_creation: false,
allow_auto_completion: true,
expected_difficulty: 7,
uuid: uuid,
user: user)
uuid:,
user:)
end
let(:uuid) { nil }

View File

@ -2,6 +2,6 @@
module Authentication
def sign_in(user, password)
page.driver.post(sessions_url, email: user.email, password: password)
page.driver.post(sessions_url, email: user.email, password:)
end
end