Fix Rubocop offenses

This commit is contained in:
Sebastian Serth
2022-07-08 15:23:55 +02:00
parent ac453e841b
commit 5e9bf9141c
18 changed files with 87 additions and 87 deletions

View File

@ -9,7 +9,7 @@ describe Admin::DashboardController do
describe 'with format HTML' do
before { get :show }
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -17,7 +17,7 @@ describe Admin::DashboardController do
before { get :show, format: :json }
expect_json
expect_status(200)
expect_http_status(:ok)
end
end
end

View File

@ -78,7 +78,7 @@ describe ApplicationController do
describe 'GET #welcome' do
before { get :welcome }
expect_status(200)
expect_http_status(:ok)
expect_template(:welcome)
end
end

View File

@ -25,7 +25,7 @@ describe CodeOcean::FilesController do
end
expect_json
expect_status(201)
expect_http_status(:created)
end
context 'with an invalid file' do
@ -36,7 +36,7 @@ describe CodeOcean::FilesController do
expect_assigns(file: CodeOcean::File)
expect_json
expect_status(422)
expect_http_status(:unprocessable_entity)
end
end

View File

@ -19,7 +19,7 @@ describe CodeharborLinksController do
get :new
end
expect_status(200)
expect_http_status(:ok)
end
describe 'GET #edit' do
@ -27,7 +27,7 @@ describe CodeharborLinksController do
before { get :edit, params: {id: codeharbor_link.id} }
expect_status(200)
expect_http_status(:ok)
end
describe 'POST #create' do

View File

@ -27,7 +27,7 @@ describe ConsumersController do
before { post :create, params: {consumer: {}} }
expect_assigns(consumer: Consumer)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
end
@ -49,7 +49,7 @@ describe ConsumersController do
before { get :edit, params: {id: consumer.id} }
expect_assigns(consumer: Consumer)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
@ -60,7 +60,7 @@ describe ConsumersController do
end
expect_assigns(consumers: Consumer.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -68,7 +68,7 @@ describe ConsumersController do
before { get :new }
expect_assigns(consumer: Consumer)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
@ -76,7 +76,7 @@ describe ConsumersController do
before { get :show, params: {id: consumer.id} }
expect_assigns(consumer: :consumer)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -92,7 +92,7 @@ describe ConsumersController do
before { put :update, params: {consumer: {name: ''}, id: consumer.id} }
expect_assigns(consumer: Consumer)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
end

View File

@ -10,13 +10,13 @@ describe ErrorTemplateAttributesController do
it 'gets index' do
get :index
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(assigns(:error_template_attributes)).not_to be_nil
end
it 'gets new' do
get :new
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'creates error_template_attribute' do
@ -26,12 +26,12 @@ describe ErrorTemplateAttributesController do
it 'shows error_template_attribute' do
get :show, params: {id: error_template_attribute}
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'gets edit' do
get :edit, params: {id: error_template_attribute}
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'updates error_template_attribute' do

View File

@ -10,13 +10,13 @@ describe ErrorTemplatesController do
it 'gets index' do
get :index
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
expect(assigns(:error_templates)).not_to be_nil
end
it 'gets new' do
get :new
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'creates error_template' do
@ -26,12 +26,12 @@ describe ErrorTemplatesController do
it 'shows error_template' do
get :show, params: {id: error_template}
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'gets edit' do
get :edit, params: {id: error_template}
expect(response.status).to eq(200)
expect(response).to have_http_status(:ok)
end
it 'updates error_template' do

View File

@ -20,20 +20,20 @@ describe EventsController do
expect { perform_request.call }.to change(Event, :count).by(1)
end
expect_status(201)
expect_http_status(:created)
end
context 'with an invalid event' do
before { post :create, params: {event: {exercise_id: 847_482}} }
expect_assigns(event: Event)
expect_status(422)
expect_http_status(:unprocessable_entity)
end
context 'with no event' do
before { post :create }
expect_status(422)
expect_http_status(:unprocessable_entity)
end
end
end

View File

@ -46,7 +46,7 @@ describe ExecutionEnvironmentsController do
end
expect_assigns(execution_environment: ExecutionEnvironment)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
it 'does not register the execution environment with the runner management' do
@ -82,7 +82,7 @@ describe ExecutionEnvironmentsController do
expect_assigns(docker_images: Array)
expect_assigns(execution_environment: :execution_environment)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
@ -98,7 +98,7 @@ describe ExecutionEnvironmentsController do
expect_assigns(execution_environment: :execution_environment)
expect_json
expect_status(200)
expect_http_status(:ok)
end
describe 'GET #index' do
@ -108,7 +108,7 @@ describe ExecutionEnvironmentsController do
end
expect_assigns(execution_environments: ExecutionEnvironment.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -119,7 +119,7 @@ describe ExecutionEnvironmentsController do
expect_assigns(docker_images: Array)
expect_assigns(execution_environment: ExecutionEnvironment)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
@ -158,7 +158,7 @@ describe ExecutionEnvironmentsController do
before { get :shell, params: {id: execution_environment.id} }
expect_assigns(execution_environment: :execution_environment)
expect_status(200)
expect_http_status(:ok)
expect_template(:shell)
end
@ -166,7 +166,7 @@ describe ExecutionEnvironmentsController do
before { get :statistics, params: {id: execution_environment.id} }
expect_assigns(execution_environment: :execution_environment)
expect_status(200)
expect_http_status(:ok)
expect_template(:statistics)
end
@ -174,7 +174,7 @@ describe ExecutionEnvironmentsController do
before { get :show, params: {id: execution_environment.id} }
expect_assigns(execution_environment: :execution_environment)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -206,7 +206,7 @@ describe ExecutionEnvironmentsController do
end
expect_assigns(execution_environment: ExecutionEnvironment)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
it 'does not update the execution environment at the runner management' do

View File

@ -20,7 +20,7 @@ describe ExercisesController do
end
expect_json
expect_status(200)
expect_http_status(:ok)
end
describe 'POST #clone' do
@ -122,7 +122,7 @@ describe ExercisesController do
before { post :create, params: {exercise: {}} }
expect_assigns(exercise: Exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
end
@ -144,7 +144,7 @@ describe ExercisesController do
before { get :edit, params: {id: exercise.id} }
expect_assigns(exercise: :exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
@ -173,7 +173,7 @@ describe ExercisesController do
end
end
expect_status(200)
expect_http_status(:ok)
expect_template(:implement)
end
@ -195,7 +195,7 @@ describe ExercisesController do
end
expect_assigns(exercises: :scope)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -204,7 +204,7 @@ describe ExercisesController do
expect_assigns(execution_environments: ExecutionEnvironment.all, exercise: Exercise)
expect_assigns(exercise: Exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
@ -213,7 +213,7 @@ describe ExercisesController do
before { get :show, params: {id: exercise.id} }
expect_assigns(exercise: :exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
end
@ -223,7 +223,7 @@ describe ExercisesController do
before { get :reload, format: :json, params: {id: exercise.id} }
expect_assigns(exercise: :exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:reload)
end
end
@ -232,7 +232,7 @@ describe ExercisesController do
before { get :statistics, params: {id: exercise.id} }
expect_assigns(exercise: :exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:statistics)
end
@ -285,7 +285,7 @@ describe ExercisesController do
end
expect_json
expect_status(200)
expect_http_status(:ok)
end
context 'when the score transmission fails' do
@ -301,7 +301,7 @@ describe ExercisesController do
end
expect_json
expect_status(503)
expect_http_status(:service_unavailable)
end
end
@ -322,7 +322,7 @@ describe ExercisesController do
end
expect_json
expect_status(200)
expect_http_status(:ok)
end
end
@ -340,7 +340,7 @@ describe ExercisesController do
before { put :update, params: {exercise: {title: ''}, id: exercise.id} }
expect_assigns(exercise: Exercise)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
end

View File

@ -12,7 +12,7 @@ describe ExternalUsersController do
before { get :index }
expect_assigns(users: ExternalUser.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -20,7 +20,7 @@ describe ExternalUsersController do
before { get :show, params: {id: users.first.id} }
expect_assigns(user: ExternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
end

View File

@ -29,7 +29,7 @@ describe FileTypesController do
expect_assigns(editor_modes: Array)
expect_assigns(file_type: FileType)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
end
@ -52,7 +52,7 @@ describe FileTypesController do
expect_assigns(editor_modes: Array)
expect_assigns(file_type: FileType)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
@ -63,7 +63,7 @@ describe FileTypesController do
end
expect_assigns(file_types: FileType.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -72,7 +72,7 @@ describe FileTypesController do
expect_assigns(editor_modes: Array)
expect_assigns(file_type: FileType)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
@ -80,7 +80,7 @@ describe FileTypesController do
before { get :show, params: {id: file_type.id} }
expect_assigns(file_type: :file_type)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -98,7 +98,7 @@ describe FileTypesController do
expect_assigns(editor_modes: Array)
expect_assigns(file_type: FileType)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
end

View File

@ -33,7 +33,7 @@ describe InternalUsersController do
before { get :activate, params: {id: user.id, token: user.activation_token} }
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:activate)
end
end
@ -138,7 +138,7 @@ describe InternalUsersController do
before { post :create, params: {internal_user: {}} }
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
end
@ -165,7 +165,7 @@ describe InternalUsersController do
end
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
@ -178,7 +178,7 @@ describe InternalUsersController do
get :forgot_password
end
expect_status(200)
expect_http_status(:ok)
expect_template(:forgot_password)
end
@ -213,7 +213,7 @@ describe InternalUsersController do
context 'without an email address' do
before { post :forgot_password }
expect_status(200)
expect_http_status(:ok)
expect_template(:forgot_password)
end
end
@ -225,7 +225,7 @@ describe InternalUsersController do
end
expect_assigns(users: InternalUser.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -236,7 +236,7 @@ describe InternalUsersController do
end
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end
@ -256,7 +256,7 @@ describe InternalUsersController do
end
expect_assigns(user: :user)
expect_status(200)
expect_http_status(:ok)
expect_template(:reset_password)
end
end
@ -295,7 +295,7 @@ describe InternalUsersController do
end
expect_assigns(user: :user)
expect_status(200)
expect_http_status(:ok)
expect_template(:reset_password)
end
end
@ -308,7 +308,7 @@ describe InternalUsersController do
end
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -326,7 +326,7 @@ describe InternalUsersController do
before { put :update, params: {internal_user: {email: ''}, id: users.first.id} }
expect_assigns(user: InternalUser)
expect_status(200)
expect_http_status(:ok)
expect_template(:edit)
end
end

View File

@ -35,14 +35,14 @@ describe RequestForCommentsController do
describe 'GET #my_comment_requests' do
before { get :my_comment_requests }
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
describe 'GET #rfcs_with_my_comments' do
before { get :rfcs_with_my_comments }
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -52,7 +52,7 @@ describe RequestForCommentsController do
get :rfcs_for_exercise, params: {exercise_id: exercise.id}
end
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
end

View File

@ -217,7 +217,7 @@ describe SessionsController do
perform_request.call
end
expect_status(200)
expect_http_status(:ok)
expect_template(:destroy_through_lti)
end
@ -230,7 +230,7 @@ describe SessionsController do
get :new
end
expect_status(200)
expect_http_status(:ok)
expect_template(:new)
end

View File

@ -11,7 +11,7 @@ describe StatisticsController do
describe "GET ##{route}" do
before { get route }
expect_status(200)
expect_http_status(:ok)
expect_template(route)
end
end
@ -20,7 +20,7 @@ describe StatisticsController do
describe "GET ##{route}" do
before { get route }
expect_status(200)
expect_http_status(:ok)
expect_template(:activity_history)
end
end
@ -29,7 +29,7 @@ describe StatisticsController do
describe "GET ##{route}.json" do
before { get route, format: :json }
expect_status(200)
expect_http_status(:ok)
expect_json
end
end

View File

@ -26,7 +26,7 @@ describe SubmissionsController do
end
expect_json
expect_status(201)
expect_http_status(:created)
end
context 'with an invalid submission' do
@ -34,7 +34,7 @@ describe SubmissionsController do
expect_assigns(submission: Submission)
expect_json
expect_status(422)
expect_http_status(:unprocessable_entity)
end
end
@ -42,7 +42,7 @@ describe SubmissionsController do
context 'with an invalid filename' do
before { get :download_file, params: {filename: SecureRandom.hex, id: submission.id} }
expect_status(404)
expect_http_status(:not_found)
end
context 'with a valid binary filename' do
@ -56,7 +56,7 @@ describe SubmissionsController do
expect_assigns(file: :file)
expect_assigns(submission: :submission)
expect_content_type('application/octet-stream')
expect_status(200)
expect_http_status(:ok)
it 'sets the correct filename' do
expect(response.headers['Content-Disposition']).to include("attachment; filename=\"#{file.name_with_extension}\"")
@ -75,7 +75,7 @@ describe SubmissionsController do
expect_assigns(file: :file)
expect_assigns(submission: :submission)
expect_content_type('video/mp4')
expect_status(200)
expect_http_status(:ok)
it 'sets the correct filename' do
expect(response.headers['Content-Disposition']).to include("attachment; filename=\"#{file.name_with_extension}\"")
@ -88,7 +88,7 @@ describe SubmissionsController do
expect_assigns(file: :file)
expect_assigns(submission: :submission)
expect_content_type('text/javascript')
expect_status(200)
expect_http_status(:ok)
it 'sets the correct filename' do
expect(response.headers['Content-Disposition']).to include("attachment; filename=\"#{file.name_with_extension}\"")
@ -104,7 +104,7 @@ describe SubmissionsController do
end
expect_assigns(submissions: Submission.all)
expect_status(200)
expect_http_status(:ok)
expect_template(:index)
end
@ -114,7 +114,7 @@ describe SubmissionsController do
context 'with an invalid filename' do
before { get :render_file, params: {filename: SecureRandom.hex, id: submission.id} }
expect_status(404)
expect_http_status(:not_found)
end
context 'with a valid filename' do
@ -128,7 +128,7 @@ describe SubmissionsController do
expect_assigns(file: :file)
expect_assigns(submission: :submission)
expect_content_type('video/mp4')
expect_status(200)
expect_http_status(:ok)
it 'renders the file content' do
expect(response.body).to eq(file.native_file.read)
@ -141,7 +141,7 @@ describe SubmissionsController do
expect_assigns(file: :file)
expect_assigns(submission: :submission)
expect_content_type('text/javascript')
expect_status(200)
expect_http_status(:ok)
it 'renders the file content' do
expect(response.body).to eq(file.content)
@ -167,7 +167,7 @@ describe SubmissionsController do
before { get :show, params: {id: submission.id} }
expect_assigns(submission: :submission)
expect_status(200)
expect_http_status(:ok)
expect_template(:show)
end
@ -179,7 +179,7 @@ describe SubmissionsController do
before { get :show, params: {id: submission.id}, format: :json }
expect_assigns(submission: :submission)
expect_status(200)
expect_http_status(:ok)
%i[render run test].each do |action|
describe "##{action}_url" do