fixed multiple style guide violations
This commit is contained in:
@ -1,5 +1,5 @@
|
|||||||
module CommonBehavior
|
module CommonBehavior
|
||||||
def create_and_respond(options = {}, &block)
|
def create_and_respond(options = {})
|
||||||
@object = options[:object]
|
@object = options[:object]
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
if @object.save
|
if @object.save
|
||||||
|
@ -2,8 +2,8 @@ module SubmissionParameters
|
|||||||
include FileParameters
|
include FileParameters
|
||||||
|
|
||||||
def reject_illegal_file_attributes!(submission_params)
|
def reject_illegal_file_attributes!(submission_params)
|
||||||
if exercise = Exercise.find_by(id: submission_params[:exercise_id])
|
if Exercise.exists?(id: submission_params[:exercise_id])
|
||||||
submission_params[:files_attributes].try(:reject!) do |index, file_attributes|
|
submission_params[:files_attributes].try(:reject!) do |_, file_attributes|
|
||||||
file = CodeOcean::File.find_by(id: file_attributes[:file_id])
|
file = CodeOcean::File.find_by(id: file_attributes[:file_id])
|
||||||
file.nil? || file.hidden || file.read_only
|
file.nil? || file.hidden || file.read_only
|
||||||
end
|
end
|
||||||
|
@ -24,7 +24,7 @@ class ExecutionEnvironmentsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def execute_command
|
def execute_command
|
||||||
@docker_client = DockerClient.new(execution_environment: @execution_environment, user: current_user)
|
@docker_client = DockerClient.new(execution_environment: @execution_environment)
|
||||||
render(json: @docker_client.execute_arbitrary_command(params[:command]))
|
render(json: @docker_client.execute_arbitrary_command(params[:command]))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ class SessionsController < ApplicationController
|
|||||||
skip_before_action :verify_authenticity_token, only: :create_through_lti
|
skip_before_action :verify_authenticity_token, only: :create_through_lti
|
||||||
|
|
||||||
def create
|
def create
|
||||||
if user = login(params[:email], params[:password], params[:remember_me])
|
if login(params[:email], params[:password], params[:remember_me])
|
||||||
redirect_back_or_to(:root, notice: t('.success'))
|
redirect_back_or_to(:root, notice: t('.success'))
|
||||||
else
|
else
|
||||||
flash.now[:danger] = t('.failure')
|
flash.now[:danger] = t('.failure')
|
||||||
|
@ -72,7 +72,7 @@ class SubmissionsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_docker_client
|
def set_docker_client
|
||||||
@docker_client = DockerClient.new(execution_environment: @submission.execution_environment, user: current_user)
|
@docker_client = DockerClient.new(execution_environment: @submission.execution_environment)
|
||||||
end
|
end
|
||||||
private :set_docker_client
|
private :set_docker_client
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ module ApplicationHelper
|
|||||||
Kramdown::Document.new(markdown).to_html.html_safe
|
Kramdown::Document.new(markdown).to_html.html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
def row(options={}, &block)
|
def row(options = {}, &block)
|
||||||
content_tag(:div, class: 'attribute-row row') do
|
content_tag(:div, class: 'attribute-row row') do
|
||||||
label_column(options[:label]) + value_column(options[:value], &block)
|
label_column(options[:label]) + value_column(options[:value], &block)
|
||||||
end
|
end
|
||||||
@ -65,7 +65,7 @@ module ApplicationHelper
|
|||||||
end
|
end
|
||||||
private :translation_present?
|
private :translation_present?
|
||||||
|
|
||||||
def value_column(value, &block)
|
def value_column(value)
|
||||||
content_tag(:div, class: 'col-sm-9') do
|
content_tag(:div, class: 'col-sm-9') do
|
||||||
block_given? ? yield : symbol_for(value)
|
block_given? ? yield : symbol_for(value)
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ class UserMailer < ActionMailer::Base
|
|||||||
mail(subject: t('mailers.user_mailer.activation_needed.subject'), to: user.email)
|
mail(subject: t('mailers.user_mailer.activation_needed.subject'), to: user.email)
|
||||||
end
|
end
|
||||||
|
|
||||||
def activation_success_email(user)
|
def activation_success_email(*)
|
||||||
end
|
end
|
||||||
|
|
||||||
def reset_password_email(user)
|
def reset_password_email(user)
|
||||||
|
@ -13,7 +13,7 @@ module User
|
|||||||
end
|
end
|
||||||
|
|
||||||
ROLES.each do |role|
|
ROLES.each do |role|
|
||||||
define_method("#{role}?") { self.try(:role) == role }
|
define_method("#{role}?") { try(:role) == role }
|
||||||
end
|
end
|
||||||
|
|
||||||
def external?
|
def external?
|
||||||
|
@ -7,6 +7,8 @@ class Submission < ActiveRecord::Base
|
|||||||
|
|
||||||
belongs_to :exercise
|
belongs_to :exercise
|
||||||
|
|
||||||
|
delegate :execution_environment, to: :exercise
|
||||||
|
|
||||||
scope :final, -> { where(cause: 'submit') }
|
scope :final, -> { where(cause: 'submit') }
|
||||||
scope :intermediate, -> { where.not(cause: 'submit') }
|
scope :intermediate, -> { where.not(cause: 'submit') }
|
||||||
|
|
||||||
@ -24,10 +26,6 @@ class Submission < ActiveRecord::Base
|
|||||||
ancestors.merge(descendants).values
|
ancestors.merge(descendants).values
|
||||||
end
|
end
|
||||||
|
|
||||||
def execution_environment
|
|
||||||
exercise.execution_environment
|
|
||||||
end
|
|
||||||
|
|
||||||
[:download, :render, :run, :test].each do |action|
|
[:download, :render, :run, :test].each do |action|
|
||||||
filename = FILENAME_URL_PLACEHOLDER.gsub(/\W/, '')
|
filename = FILENAME_URL_PLACEHOLDER.gsub(/\W/, '')
|
||||||
define_method("#{action}_url") do
|
define_method("#{action}_url") do
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
# Be sure to restart your server when you modify this file.
|
# Be sure to restart your server when you modify this file.
|
||||||
|
|
||||||
Rails.application.config.action_dispatch.cookies_serializer = :json
|
Rails.application.config.action_dispatch.cookies_serializer = :json
|
||||||
|
@ -1 +1 @@
|
|||||||
Docker::Container::send(:include, DockerContainerMixin)
|
Docker::Container.send(:include, DockerContainerMixin)
|
||||||
|
12
db/seeds.rb
12
db/seeds.rb
@ -4,11 +4,13 @@ def find_factories_by_class(klass)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class ActiveRecord::Base
|
module ActiveRecord
|
||||||
[:build, :create].each do |strategy|
|
class Base
|
||||||
define_singleton_method("#{strategy}_factories") do |attributes = {}|
|
[:build, :create].each do |strategy|
|
||||||
find_factories_by_class(self).map(&:name).map do |factory_name|
|
define_singleton_method("#{strategy}_factories") do |attributes = {}|
|
||||||
FactoryGirl.send(strategy, factory_name, attributes)
|
find_factories_by_class(self).map(&:name).map do |factory_name|
|
||||||
|
FactoryGirl.send(strategy, factory_name, attributes)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -4,7 +4,7 @@ class Assessor
|
|||||||
def assess(output)
|
def assess(output)
|
||||||
test_outcome = @testing_framework_adapter.test_outcome(output)
|
test_outcome = @testing_framework_adapter.test_outcome(output)
|
||||||
test_outcome.merge(score: calculate_score(test_outcome))
|
test_outcome.merge(score: calculate_score(test_outcome))
|
||||||
rescue Exception
|
rescue
|
||||||
{score: 0}
|
{score: 0}
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -20,7 +20,6 @@ class Assessor
|
|||||||
fail(Error, 'No testing framework adapter set!')
|
fail(Error, 'No testing framework adapter set!')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
class Assessor::Error < RuntimeError
|
class Error < RuntimeError; end
|
||||||
end
|
end
|
||||||
|
@ -6,15 +6,14 @@ module CodeOcean
|
|||||||
|
|
||||||
def read(options = {})
|
def read(options = {})
|
||||||
path = Rails.root.join('config', "#{@filename}.yml#{options[:erb] ? '.erb' : ''}")
|
path = Rails.root.join('config', "#{@filename}.yml#{options[:erb] ? '.erb' : ''}")
|
||||||
if ::File.exists?(path)
|
if ::File.exist?(path)
|
||||||
content = options[:erb] ? YAML.load(ERB.new(::File.new(path, 'r').read).result) : YAML.load_file(path)
|
content = options[:erb] ? YAML.load(ERB.new(::File.new(path, 'r').read).result) : YAML.load_file(path)
|
||||||
content[Rails.env].with_indifferent_access
|
content[Rails.env].with_indifferent_access
|
||||||
else
|
else
|
||||||
fail(Error, "Configuration file not found: #{path}")
|
fail(Error, "Configuration file not found: #{path}")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
class Config::Error < RuntimeError
|
class Error < RuntimeError; end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ class DockerClient
|
|||||||
attr_reader :container_id
|
attr_reader :container_id
|
||||||
|
|
||||||
def self.check_availability!
|
def self.check_availability!
|
||||||
Timeout::timeout(config[:connection_timeout]) { Docker.version }
|
Timeout.timeout(config[:connection_timeout]) { Docker.version }
|
||||||
rescue Excon::Errors::SocketError, Timeout::Error
|
rescue Excon::Errors::SocketError, Timeout::Error
|
||||||
raise(Error, "The Docker host at #{Docker.url} is not reachable!")
|
raise(Error, "The Docker host at #{Docker.url} is not reachable!")
|
||||||
end
|
end
|
||||||
@ -94,7 +94,6 @@ class DockerClient
|
|||||||
|
|
||||||
def initialize(options = {})
|
def initialize(options = {})
|
||||||
@execution_environment = options[:execution_environment]
|
@execution_environment = options[:execution_environment]
|
||||||
@user = options[:user]
|
|
||||||
@image = self.class.find_image_by_tag(@execution_environment.docker_image)
|
@image = self.class.find_image_by_tag(@execution_environment.docker_image)
|
||||||
fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
fail(Error, "Cannot find image #{@execution_environment.docker_image}!") unless @image
|
||||||
end
|
end
|
||||||
@ -133,7 +132,7 @@ class DockerClient
|
|||||||
end
|
end
|
||||||
|
|
||||||
def send_command(command, container, &block)
|
def send_command(command, container, &block)
|
||||||
Timeout::timeout(@execution_environment.permitted_execution_time) do
|
Timeout.timeout(@execution_environment.permitted_execution_time) do
|
||||||
stderr = []
|
stderr = []
|
||||||
stdout = []
|
stdout = []
|
||||||
container.attach(stdin: StringIO.new(command)) do |stream, chunk|
|
container.attach(stdin: StringIO.new(command)) do |stream, chunk|
|
||||||
@ -152,7 +151,6 @@ class DockerClient
|
|||||||
Concurrent::Future.execute { self.class.destroy_container(container) }
|
Concurrent::Future.execute { self.class.destroy_container(container) }
|
||||||
end
|
end
|
||||||
private :send_command
|
private :send_command
|
||||||
end
|
|
||||||
|
|
||||||
class DockerClient::Error < RuntimeError
|
class Error < RuntimeError; end
|
||||||
end
|
end
|
||||||
|
@ -6,12 +6,12 @@ namespace :docker do
|
|||||||
end
|
end
|
||||||
|
|
||||||
desc 'List all installed Docker images'
|
desc 'List all installed Docker images'
|
||||||
task :images => :environment do
|
task images: :environment do
|
||||||
puts DockerClient.image_tags
|
puts DockerClient.image_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Pull all Docker images referenced by execution environments'
|
desc 'Pull all Docker images referenced by execution environments'
|
||||||
task :pull => :environment do
|
task pull: :environment do
|
||||||
ExecutionEnvironment.all.map(&:docker_image).each do |docker_image|
|
ExecutionEnvironment.all.map(&:docker_image).each do |docker_image|
|
||||||
puts "Pulling #{docker_image}..."
|
puts "Pulling #{docker_image}..."
|
||||||
DockerClient.pull(docker_image)
|
DockerClient.pull(docker_image)
|
||||||
|
@ -11,10 +11,10 @@ class TestingFrameworkAdapter
|
|||||||
private :augment_output
|
private :augment_output
|
||||||
|
|
||||||
def self.framework_name
|
def self.framework_name
|
||||||
self.name
|
name
|
||||||
end
|
end
|
||||||
|
|
||||||
def parse_output(output)
|
def parse_output(*)
|
||||||
fail(NotImplementedError, "#{self.class} should implement #parse_output!")
|
fail(NotImplementedError, "#{self.class} should implement #parse_output!")
|
||||||
end
|
end
|
||||||
private :parse_output
|
private :parse_output
|
||||||
|
@ -67,7 +67,7 @@ describe Lti do
|
|||||||
describe '#return_to_consumer' do
|
describe '#return_to_consumer' do
|
||||||
context 'with a return URL' do
|
context 'with a return URL' do
|
||||||
let(:consumer_return_url) { 'http://example.org' }
|
let(:consumer_return_url) { 'http://example.org' }
|
||||||
before(:each) { expect(controller).to receive(:params).and_return({launch_presentation_return_url: consumer_return_url}) }
|
before(:each) { expect(controller).to receive(:params).and_return(launch_presentation_return_url: consumer_return_url) }
|
||||||
|
|
||||||
it 'redirects to the tool consumer' do
|
it 'redirects to the tool consumer' do
|
||||||
expect(controller).to receive(:redirect_to).with(consumer_return_url)
|
expect(controller).to receive(:redirect_to).with(consumer_return_url)
|
||||||
|
@ -38,7 +38,7 @@ describe CodeOcean::FilesController do
|
|||||||
expect_assigns(file: CodeOcean::File)
|
expect_assigns(file: CodeOcean::File)
|
||||||
|
|
||||||
it 'destroys the file' do
|
it 'destroys the file' do
|
||||||
exercise = FactoryGirl.create(:fibonacci)
|
FactoryGirl.create(:fibonacci)
|
||||||
expect { request.call }.to change(CodeOcean::File, :count).by(-1)
|
expect { request.call }.to change(CodeOcean::File, :count).by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ describe ExecutionEnvironmentsController do
|
|||||||
let(:command) { 'which ruby' }
|
let(:command) { 'which ruby' }
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
expect(DockerClient).to receive(:new).with(execution_environment: execution_environment, user: user).and_call_original
|
expect(DockerClient).to receive(:new).with(execution_environment: execution_environment).and_call_original
|
||||||
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).with(command)
|
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).with(command)
|
||||||
post :execute_command, command: command, id: execution_environment.id
|
post :execute_command, command: command, id: execution_environment.id
|
||||||
end
|
end
|
||||||
|
@ -30,7 +30,7 @@ describe ExercisesController do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a file upload" do
|
context 'with a file upload' do
|
||||||
let(:files_attributes) { {'0' => FactoryGirl.build(:file, content: fixture_file_upload('upload.rb', 'text/x-ruby')).attributes} }
|
let(:files_attributes) { {'0' => FactoryGirl.build(:file, content: fixture_file_upload('upload.rb', 'text/x-ruby')).attributes} }
|
||||||
let(:request) { proc { post :create, exercise: exercise_attributes.merge(files_attributes: files_attributes) } }
|
let(:request) { proc { post :create, exercise: exercise_attributes.merge(files_attributes: files_attributes) } }
|
||||||
|
|
||||||
@ -144,7 +144,7 @@ describe ExercisesController do
|
|||||||
|
|
||||||
context 'when the score transmission succeeds' do
|
context 'when the score transmission succeeds' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
expect(controller).to receive(:send_score).and_return({status: 'success'})
|
expect(controller).to receive(:send_score).and_return(status: 'success')
|
||||||
request
|
request
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ describe ExercisesController do
|
|||||||
|
|
||||||
context 'when the score transmission fails' do
|
context 'when the score transmission fails' do
|
||||||
before(:each) do
|
before(:each) do
|
||||||
expect(controller).to receive(:send_score).and_return({status: 'unsupported'})
|
expect(controller).to receive(:send_score).and_return(status: 'unsupported')
|
||||||
request
|
request
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ def create_seed_file(exercise, path, file_attributes = {})
|
|||||||
else
|
else
|
||||||
file_attributes.merge!(content: SeedsHelper.read_seed_file(path))
|
file_attributes.merge!(content: SeedsHelper.read_seed_file(path))
|
||||||
end
|
end
|
||||||
file = exercise.add_file!(file_attributes)
|
exercise.add_file!(file_attributes)
|
||||||
end
|
end
|
||||||
|
|
||||||
FactoryGirl.define do
|
FactoryGirl.define do
|
||||||
@ -18,7 +18,7 @@ FactoryGirl.define do
|
|||||||
created_by_teacher
|
created_by_teacher
|
||||||
description "Try HTML's audio and video capabilities."
|
description "Try HTML's audio and video capabilities."
|
||||||
association :execution_environment, factory: :html
|
association :execution_environment, factory: :html
|
||||||
instructions "Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4."
|
instructions 'Build a simple website including an HTML <audio> and <video> element. Link the following media files: chai.ogg, devstories.mp4.'
|
||||||
title 'Audio & Video'
|
title 'Audio & Video'
|
||||||
|
|
||||||
after(:create) do |exercise|
|
after(:create) do |exercise|
|
||||||
|
@ -182,9 +182,7 @@ FactoryGirl.define do
|
|||||||
end
|
end
|
||||||
|
|
||||||
%w(binary executable renderable).each do |attribute|
|
%w(binary executable renderable).each do |attribute|
|
||||||
trait(attribute) do
|
trait(attribute) { send(attribute, true) }
|
||||||
self.send(attribute, true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
trait :singleton_file_type do
|
trait :singleton_file_type do
|
||||||
|
@ -27,10 +27,8 @@ describe DockerContainerPool do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'destroys all containers' do
|
it 'destroys all containers' do
|
||||||
described_class.instance_variable_get(:@containers).each do |key, value|
|
described_class.instance_variable_get(:@containers).values.flatten.each do |container|
|
||||||
value.each do |container|
|
expect(DockerClient).to receive(:destroy_container).with(container)
|
||||||
expect(DockerClient).to receive(:destroy_container).with(container)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -10,7 +10,7 @@ describe JunitAdapter do
|
|||||||
let(:stdout) { "FAILURES!!!\nTests run: #{count}, Failures: #{failed}" }
|
let(:stdout) { "FAILURES!!!\nTests run: #{count}, Failures: #{failed}" }
|
||||||
|
|
||||||
it 'returns the correct numbers' do
|
it 'returns the correct numbers' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, failed: failed})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ describe JunitAdapter do
|
|||||||
let(:stdout) { "OK (#{count} tests)" }
|
let(:stdout) { "OK (#{count} tests)" }
|
||||||
|
|
||||||
it 'returns the correct numbers' do
|
it 'returns the correct numbers' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, passed: count})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, passed: count)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ describe PyUnitAdapter do
|
|||||||
|
|
||||||
describe '#parse_output' do
|
describe '#parse_output' do
|
||||||
it 'returns the correct numbers' do
|
it 'returns the correct numbers' do
|
||||||
expect(adapter.parse_output(stderr: stderr)).to eq({count: count, failed: failed})
|
expect(adapter.parse_output(stderr: stderr)).to eq(count: count, failed: failed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ describe RspecAdapter do
|
|||||||
|
|
||||||
describe '#parse_output' do
|
describe '#parse_output' do
|
||||||
it 'returns the correct numbers' do
|
it 'returns the correct numbers' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: count, failed: failed})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: count, failed: failed)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,7 @@ describe SqlResultSetComparatorAdapter do
|
|||||||
let(:stdout) { "Missing tuples: [1]\nUnexpected tuples: []" }
|
let(:stdout) { "Missing tuples: [1]\nUnexpected tuples: []" }
|
||||||
|
|
||||||
it 'considers the test as failed' do
|
it 'considers the test as failed' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, failed: 1})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ describe SqlResultSetComparatorAdapter do
|
|||||||
let(:stdout) { "Missing tuples: []\nUnexpected tuples: [1]" }
|
let(:stdout) { "Missing tuples: []\nUnexpected tuples: [1]" }
|
||||||
|
|
||||||
it 'considers the test as failed' do
|
it 'considers the test as failed' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, failed: 1})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, failed: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -24,7 +24,7 @@ describe SqlResultSetComparatorAdapter do
|
|||||||
let(:stdout) { "Missing tuples: []\nUnexpected tuples: []" }
|
let(:stdout) { "Missing tuples: []\nUnexpected tuples: []" }
|
||||||
|
|
||||||
it 'considers the test as passed' do
|
it 'considers the test as passed' do
|
||||||
expect(adapter.parse_output(stdout: stdout)).to eq({count: 1, passed: 1})
|
expect(adapter.parse_output(stdout: stdout)).to eq(count: 1, passed: 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,7 @@ describe CodeOcean::File do
|
|||||||
|
|
||||||
context 'as a teacher-defined test' do
|
context 'as a teacher-defined test' do
|
||||||
before(:each) { file.update(role: 'teacher_defined_test') }
|
before(:each) { file.update(role: 'teacher_defined_test') }
|
||||||
|
|
||||||
it 'validates the presence of a feedback message' do
|
it 'validates the presence of a feedback message' do
|
||||||
expect(file.errors[:feedback_message]).to be_present
|
expect(file.errors[:feedback_message]).to be_present
|
||||||
end
|
end
|
||||||
|
@ -81,7 +81,7 @@ describe ExecutionEnvironment do
|
|||||||
|
|
||||||
context 'when the command produces an error' do
|
context 'when the command produces an error' do
|
||||||
it 'adds an error' do
|
it 'adds an error' do
|
||||||
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).and_return({stderr: 'command not found'})
|
expect_any_instance_of(DockerClient).to receive(:execute_arbitrary_command).and_return(stderr: 'command not found')
|
||||||
working_docker_image?
|
working_docker_image?
|
||||||
expect(execution_environment.errors[:docker_image]).to be_present
|
expect(execution_environment.errors[:docker_image]).to be_present
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
# This file is copied to spec/ when you run 'rails generate rspec:install'
|
||||||
ENV["RAILS_ENV"] ||= 'test'
|
ENV['RAILS_ENV'] ||= 'test'
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
require File.expand_path("../../config/environment", __FILE__)
|
require File.expand_path('../../config/environment', __FILE__)
|
||||||
require 'rspec/rails'
|
require 'rspec/rails'
|
||||||
require 'pundit/rspec'
|
require 'pundit/rspec'
|
||||||
|
|
||||||
@ -12,7 +12,7 @@ require 'pundit/rspec'
|
|||||||
# run twice. It is recommended that you do not name files matching this glob to
|
# 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
|
# 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`.
|
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
|
||||||
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
|
Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
|
||||||
|
|
||||||
# Checks for pending migrations before tests are run.
|
# Checks for pending migrations before tests are run.
|
||||||
# If you are not using ActiveRecord, you can remove this line.
|
# If you are not using ActiveRecord, you can remove this line.
|
||||||
|
@ -3,7 +3,7 @@ class AnonymousController < ApplicationController
|
|||||||
@flash ||= {}
|
@flash ||= {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def redirect_to(*options)
|
def redirect_to(*)
|
||||||
end
|
end
|
||||||
|
|
||||||
def session
|
def session
|
||||||
|
Reference in New Issue
Block a user