Remove all occurrences of server-sent events
This commit is contained in:
@ -154,10 +154,6 @@ describe SubmissionsController do
|
||||
let(:filename) { submission.collect_files.detect(&:main_file?).name_with_extension }
|
||||
let(:perform_request) { get :run, params: {filename: filename, id: submission.id} }
|
||||
|
||||
before do
|
||||
allow_any_instance_of(ActionController::Live::SSE).to receive(:write).at_least(3).times
|
||||
end
|
||||
|
||||
context 'when no errors occur during execution' do
|
||||
before do
|
||||
allow_any_instance_of(DockerClient).to receive(:execute_run_command).with(submission, filename).and_return({})
|
||||
@ -229,54 +225,4 @@ describe SubmissionsController do
|
||||
|
||||
pending('todo')
|
||||
end
|
||||
|
||||
describe '#with_server_sent_events' do
|
||||
let(:response) { ActionDispatch::TestResponse.new }
|
||||
|
||||
before { allow(controller).to receive(:response).and_return(response) }
|
||||
|
||||
context 'when no error occurs' do
|
||||
after { controller.send(:with_server_sent_events) }
|
||||
|
||||
it 'uses server-sent events' do
|
||||
expect(ActionController::Live::SSE).to receive(:new).and_call_original
|
||||
end
|
||||
|
||||
it "writes a 'start' event" do
|
||||
allow_any_instance_of(ActionController::Live::SSE).to receive(:write)
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:write).with(nil, event: 'start')
|
||||
end
|
||||
|
||||
it "writes a 'close' event" do
|
||||
allow_any_instance_of(ActionController::Live::SSE).to receive(:write)
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:write).with({code: 200}, event: 'close')
|
||||
end
|
||||
|
||||
it 'closes the stream' do
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:close).and_call_original
|
||||
end
|
||||
end
|
||||
|
||||
context 'when an error occurs' do
|
||||
after { controller.send(:with_server_sent_events) { raise } }
|
||||
|
||||
it 'uses server-sent events' do
|
||||
expect(ActionController::Live::SSE).to receive(:new).and_call_original
|
||||
end
|
||||
|
||||
it "writes a 'start' event" do
|
||||
allow_any_instance_of(ActionController::Live::SSE).to receive(:write)
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:write).with(nil, event: 'start')
|
||||
end
|
||||
|
||||
it "writes a 'close' event" do
|
||||
allow_any_instance_of(ActionController::Live::SSE).to receive(:write)
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:write).with({code: 500}, event: 'close')
|
||||
end
|
||||
|
||||
it 'closes the stream' do
|
||||
expect_any_instance_of(ActionController::Live::SSE).to receive(:close).and_call_original
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -364,7 +364,7 @@ describe DockerClient, docker: true do
|
||||
end
|
||||
|
||||
it 'provides the command to be executed as input' do
|
||||
pending('we are currently not using any input and for output server send events instead of attach.')
|
||||
pending('we are currently not using attach but rather exec.')
|
||||
expect(container).to receive(:attach).with(stdin: kind_of(StringIO))
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user