From 09e8d59070585989d73310c8e067c51153eed437 Mon Sep 17 00:00:00 2001 From: Karol Date: Sun, 16 Jun 2019 15:18:38 +0200 Subject: [PATCH 1/3] add instructions if not using docker to readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 7df97f26..db666ada 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ In order to execute code submissions using Docker, source code files are written - create *config/sendmail.yml* - create *config/smtp.yml* - use boot2docker or vagrant if there is no native support for docker on your OS +- if you want to use the app without docker (and hence without code execution) comment the validation `validate :working_docker_image?` in `models/execution_environments.rb` otherwise the seed will fail (because of missing docker connection) - create seed data by executing `rake db:seed` - if you already created a configuration for your local installation and want to use vagrant, too, be sure to log into the vagrant instance via ssh and add your database user manually to the database. Afterwards, create, migrate and seed. From 3941c43ef3f7150074fd5653f68dc9dcaff1f5dd Mon Sep 17 00:00:00 2001 From: Karol Date: Sun, 16 Jun 2019 15:19:21 +0200 Subject: [PATCH 2/3] update seeds to exclude abstract class User --- db/seeds.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/seeds.rb b/db/seeds.rb index dab9ab7d..a314dfaa 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -18,7 +18,7 @@ end # delete all present records Rails.application.eager_load! -(ApplicationRecord.descendants - [ActiveRecord::SchemaMigration]).each(&:delete_all) +(ApplicationRecord.descendants - [ActiveRecord::SchemaMigration, User]).each(&:delete_all) # delete file uploads FileUtils.rm_rf(Rails.root.join('public', 'uploads')) From 4bea81be31c2cc5b9f82a1c0a5747bac6139e243 Mon Sep 17 00:00:00 2001 From: Karol Date: Sun, 16 Jun 2019 16:08:48 +0200 Subject: [PATCH 3/3] add spec to satisfy codeclimate --- spec/db/seeds_spec.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 spec/db/seeds_spec.rb diff --git a/spec/db/seeds_spec.rb b/spec/db/seeds_spec.rb new file mode 100644 index 00000000..1a59135b --- /dev/null +++ b/spec/db/seeds_spec.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +require 'rails_helper' + +describe 'seeds' do + subject(:seed) { Rake::Task['db:seed'].invoke } + + before do + CodeOcean::Application.load_tasks + allow(Rails).to receive(:env) { 'development'.inquiry } + end + + describe 'execute db:seed' do + it 'collects the test results' do + expect { seed }.not_to raise_error(StandardError) + end + end +end