Completely remove old non-structured errors and migrate existing ones.
This commit is contained in:
@@ -157,21 +157,6 @@ describe SubmissionsController do
|
||||
|
||||
pending("todo")
|
||||
end
|
||||
|
||||
context 'when an error occurs during execution' do
|
||||
let(:stderr) { "undefined method `foo' for main:Object (NoMethodError)" }
|
||||
|
||||
before(:each) do
|
||||
expect_any_instance_of(DockerClient).to receive(:execute_run_command).with(submission, filename).and_yield(:stderr, stderr)
|
||||
end
|
||||
|
||||
after(:each) { perform_request }
|
||||
|
||||
it 'stores the error' do
|
||||
pending("no server sent events used right now")
|
||||
expect(CodeOcean::Error).to receive(:create).with(execution_environment_id: submission.exercise.execution_environment_id, message: stderr)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'GET #show' do
|
||||
|
@@ -1,6 +0,0 @@
|
||||
FactoryBot.define do
|
||||
factory :error, class: CodeOcean::Error do
|
||||
association :execution_environment, factory: :ruby
|
||||
message { "exercise.rb:4:in `<main>': undefined local variable or method `foo' for main:Object (NameError)" }
|
||||
end
|
||||
end
|
@@ -1,19 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe CodeOcean::Error do
|
||||
let(:error) { described_class.create }
|
||||
|
||||
it 'validates the presence of an execution environment' do
|
||||
expect(error.errors[:execution_environment_id]).to be_present
|
||||
end
|
||||
|
||||
it 'validates the presence of a message' do
|
||||
expect(error.errors[:message]).to be_present
|
||||
end
|
||||
|
||||
describe '.nested_resource?' do
|
||||
it 'is true' do
|
||||
expect(described_class.nested_resource?).to be true
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,41 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
describe CodeOcean::ErrorPolicy do
|
||||
subject { described_class }
|
||||
|
||||
let(:error) { FactoryBot.build(:error) }
|
||||
|
||||
[:create?, :index?, :new?].each do |action|
|
||||
permissions(action) do
|
||||
it 'grants access to admins' do
|
||||
expect(subject).to permit(FactoryBot.build(:admin), error)
|
||||
end
|
||||
|
||||
it 'grants access to teachers' do
|
||||
expect(subject).to permit(FactoryBot.build(:teacher), error)
|
||||
end
|
||||
|
||||
it 'does not grant access to external users' do
|
||||
expect(subject).not_to permit(FactoryBot.build(:external_user), error)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
[:destroy?, :edit?, :show?, :update?].each do |action|
|
||||
permissions(action) do
|
||||
it 'grants access to admins' do
|
||||
expect(subject).to permit(FactoryBot.build(:admin), error)
|
||||
end
|
||||
|
||||
it 'grants access to authors' do
|
||||
expect(subject).to permit(error.execution_environment.author, error)
|
||||
end
|
||||
|
||||
it 'does not grant access to all other users' do
|
||||
[:external_user, :teacher].each do |factory_name|
|
||||
expect(subject).not_to permit(FactoryBot.build(factory_name), error)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@@ -14,7 +14,6 @@ describe 'exercises/implement.html.slim' do
|
||||
end
|
||||
|
||||
it 'contains the required editor data attributes' do
|
||||
expect(rendered).to have_css("#editor[data-errors-url='#{execution_environment_errors_path(exercise.execution_environment)}']")
|
||||
expect(rendered).to have_css("#editor[data-exercise-id='#{exercise.id}']")
|
||||
expect(rendered).to have_css('#editor[data-message-timeout]')
|
||||
expect(rendered).to have_css("#editor[data-submissions-url='#{submissions_path}']")
|
||||
|
Reference in New Issue
Block a user