diff --git a/app/controllers/code_ocean/files_controller.rb b/app/controllers/code_ocean/files_controller.rb index 66733b45..08ca897d 100644 --- a/app/controllers/code_ocean/files_controller.rb +++ b/app/controllers/code_ocean/files_controller.rb @@ -22,7 +22,7 @@ module CodeOcean path = options[:path].try(:call) || @object respond_with_valid_object(format, notice: t('shared.object_created', model: @object.class.model_name.human), path: path, status: :created) else - # i have deleted ".file_extension" due to error "undefined method `file_extension' for nil:NilClass" + # I have deleted ".file_extension" due to error "undefined method `file_extension' for nil:NilClass" filename = (@object.path || '') + '/' + (@object.name || '') + (@object.file_type.file_extension || '') format.html { redirect_to(options[:path]); flash[:danger] = t('files.error.filename', name: filename) } format.json { render(json: @object.errors, status: :unprocessable_entity) } diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index bf327f64..667b186d 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -8,7 +8,7 @@ class ErrorsController < ApplicationController def create @error = Error.new(error_params) - authorize @error + authorize! hint = Whistleblower.new(execution_environment: @error.execution_environment).generate_hint(@error.message) respond_to do |format| format.json do diff --git a/app/controllers/submissions_controller.rb b/app/controllers/submissions_controller.rb index 1fec0b1b..a6354d8d 100644 --- a/app/controllers/submissions_controller.rb +++ b/app/controllers/submissions_controller.rb @@ -246,7 +246,8 @@ class SubmissionsController < ApplicationController end def stop - Rails.logger.debug('stopping submission ' + @submission) + # temporary disabled + # Rails.logger.error('stopping submission ' + @submission) container = Docker::Container.get(params[:container_id]) DockerClient.destroy_container(container) rescue Docker::Error::NotFoundError diff --git a/spec/controllers/submissions_controller_spec.rb b/spec/controllers/submissions_controller_spec.rb index 209ba384..8d83943c 100644 --- a/spec/controllers/submissions_controller_spec.rb +++ b/spec/controllers/submissions_controller_spec.rb @@ -200,6 +200,8 @@ describe SubmissionsController do context 'when the container can be found' do before(:each) do + #not sure where is a correct place for this call. Need to change structure of this test? + #expect(Rails.logger).to receive(:error).with(/error message/) expect(Docker::Container).to receive(:get).and_return(CONTAINER) request.call end @@ -213,6 +215,7 @@ describe SubmissionsController do context 'when the container cannot be found' do before(:each) do + #expect(Rails.logger).to receive(:error).with(/error message/) expect(Docker::Container).to receive(:get).and_raise(Docker::Error::NotFoundError) request.call end