From ac31afbd2a4f49d509b55fd55027e765504ea853 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 11 Sep 2018 10:49:36 +0200 Subject: [PATCH 01/38] Clean Gemfile and perform bundle update Signed-off-by: Sebastian Serth --- Gemfile | 11 +- Gemfile.lock | 158 +++++++++++-------------- app/assets/javascripts/application.js | 3 - app/assets/stylesheets/application.css | 1 - lib/docker_container_pool.rb | 4 +- spec/lib/docker_container_pool_spec.rb | 4 +- 6 files changed, 75 insertions(+), 106 deletions(-) diff --git a/Gemfile b/Gemfile index 11c91e55..0329ec07 100644 --- a/Gemfile +++ b/Gemfile @@ -1,12 +1,9 @@ source 'https://rubygems.org' -gem 'activerecord-jdbcpostgresql-adapter', platform: :jruby gem 'bcrypt' gem 'bootstrap-will_paginate' gem 'carrierwave' gem 'concurrent-ruby' -gem 'concurrent-ruby-ext', platform: :ruby -gem 'activerecord-deprecated_finders', require: 'active_record/deprecated_finders' gem 'docker-api', require: 'docker' gem 'factory_bot_rails' gem 'forgery' @@ -26,15 +23,11 @@ gem 'rails-i18n' gem 'ransack' gem 'rubytree' gem 'sass-rails', '>= 5.0.7' -gem 'sdoc', group: :doc gem 'slim-rails' -gem 'bootstrap_pagedown', '>= 1.1.0' -gem 'pagedown-rails' +gem 'bootstrap_pagedown' gem 'sorcery' -gem 'thread_safe' gem 'turbolinks', '< 5.0.0' # newer versions prevent loading ACE if the page containing is not accessed directly / refreshed gem 'uglifier' -gem 'will_paginate' gem 'tubesock' gem 'faye-websocket' gem 'eventmachine', '1.0.9.1' # explicitly added, this is used by faye-websocket, version 1.2.5 still has an error in eventmachine.rb:202: [BUG] Segmentation fault, which is not yet fixed and causes the whole ruby process to crash @@ -60,7 +53,6 @@ group :development, :staging do end group :development, :test, :staging do - gem 'byebug', platform: :ruby gem 'spring' end @@ -72,7 +64,6 @@ group :test do gem 'codeclimate-test-reporter', require: false gem 'database_cleaner' gem 'nyan-cat-formatter' - gem 'rake' gem 'rspec-autotest' gem 'rspec-rails' gem 'simplecov', require: false diff --git a/Gemfile.lock b/Gemfile.lock index 0c196110..b5219e5d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -31,7 +31,6 @@ GEM activemodel (= 4.2.10) activesupport (= 4.2.10) arel (~> 6.0) - activerecord-deprecated_finders (1.0.4) activesupport (4.2.10) i18n (~> 0.7) minitest (~> 5.1) @@ -46,8 +45,8 @@ GEM ast (2.4.0) autotest-rails (4.2.1) ZenTest (~> 4.5) - bcrypt (3.1.11) - better_errors (2.4.0) + bcrypt (3.1.12) + better_errors (2.5.0) coderay (>= 1.0.0) erubi (>= 1.0.0) rack (>= 0.9.0) @@ -60,8 +59,8 @@ GEM builder (3.2.3) bunny (2.11.0) amq-protocol (~> 2.3.0) - byebug (10.0.0) - capistrano (3.10.1) + byebug (10.0.2) + capistrano (3.11.0) airbrussh (>= 1.0.0) i18n rake (>= 10.0.0) @@ -69,7 +68,7 @@ GEM capistrano-bundler (1.3.0) capistrano (~> 3.1) sshkit (~> 1.2) - capistrano-rails (1.3.1) + capistrano-rails (1.4.0) capistrano (~> 3.1) capistrano-bundler (~> 1.1) capistrano-rvm (0.1.2) @@ -81,7 +80,7 @@ GEM capistrano (~> 3.7) capistrano-bundler puma (~> 3.4) - capybara (3.3.1) + capybara (3.7.1) addressable mini_mime (>= 0.1.3) nokogiri (~> 1.8) @@ -91,7 +90,7 @@ GEM capybara-selenium (0.0.6) capybara selenium-webdriver - carrierwave (1.2.2) + carrierwave (1.2.3) activemodel (>= 4.0.0) activesupport (>= 4.0.0) mime-types (>= 1.16) @@ -109,29 +108,27 @@ GEM execjs coffee-script-source (1.12.2) concurrent-ruby (1.0.5) - concurrent-ruby-ext (1.0.5) - concurrent-ruby (= 1.0.5) crass (1.0.4) d3-rails (4.13.0) railties (>= 3.1) - database_cleaner (1.6.2) + database_cleaner (1.7.0) debug_inspector (0.0.3) diff-lcs (1.3) - docile (1.1.5) - docker-api (1.34.1) + docile (1.3.1) + docker-api (1.34.2) excon (>= 0.47.0) multi_json - domain_name (0.5.20170404) + domain_name (0.5.20180417) unf (>= 0.0.5, < 1.0.0) erubi (1.7.1) erubis (2.7.0) eventmachine (1.0.9.1) - excon (0.60.0) + excon (0.62.0) execjs (2.7.0) - factory_bot (4.8.2) + factory_bot (4.11.1) activesupport (>= 3.0.0) - factory_bot_rails (4.8.2) - factory_bot (~> 4.8.2) + factory_bot_rails (4.11.1) + factory_bot (~> 4.11.1) railties (>= 3.0.0) faraday (0.12.2) multipart-post (>= 1.2, < 3) @@ -143,7 +140,7 @@ GEM globalid (0.4.1) activesupport (>= 4.2.0) headless (2.3.1) - highline (1.7.10) + highline (2.0.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (0.9.5) @@ -151,10 +148,11 @@ GEM ims-lti (1.1.10) builder oauth (~> 0.4.5) + jaro_winkler (1.5.1) jbuilder (2.7.0) activesupport (>= 4.2.0) multi_json (>= 1.2) - jquery-rails (4.3.1) + jquery-rails (4.3.3) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) @@ -163,17 +161,17 @@ GEM turbolinks json (2.1.0) jwt (1.5.6) - kramdown (1.16.2) + kramdown (1.17.0) loofah (2.2.2) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.0) mini_mime (>= 0.1.1) method_source (0.9.0) - mime-types (3.1) + mime-types (3.2.2) mime-types-data (~> 3.2015) - mime-types-data (3.2016.0521) - mini_mime (1.0.0) + mime-types-data (3.2018.0812) + mini_mime (1.0.1) mini_portile2 (2.3.0) minitest (5.11.3) mnemosyne-ruby (1.5.1) @@ -184,10 +182,10 @@ GEM multipart-post (2.0.0) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (4.2.0) + net-ssh (5.0.2) netrc (0.11.0) - newrelic_rpm (4.8.0.341) - nokogiri (1.8.3) + newrelic_rpm (5.3.0.346) + nokogiri (1.8.4) mini_portile2 (~> 2.3.0) nyan-cat-formatter (0.12.0) rspec (>= 2.99, >= 2.14.2, < 4) @@ -198,27 +196,23 @@ GEM multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - pagedown-rails (1.1.4) - railties (> 3.1) parallel (1.12.1) - parser (2.5.0.3) + parser (2.5.1.2) ast (~> 2.4.0) pg (0.21.0) - polyamorous (1.3.3) - activerecord (>= 3.0) - powerpack (0.1.1) + powerpack (0.1.2) pry (0.11.3) coderay (~> 1.1.0) method_source (~> 0.9.0) pry-byebug (3.6.0) byebug (~> 10.0) pry (~> 0.10) - public_suffix (3.0.2) - puma (3.11.3) - pundit (1.1.0) + public_suffix (3.0.3) + puma (3.12.0) + pundit (2.0.0) activesupport (>= 3.0.0) rack (1.6.10) - rack-mini-profiler (0.10.7) + rack-mini-profiler (1.0.0) rack (>= 1.2.0) rack-test (0.6.3) rack (>= 1.0) @@ -251,58 +245,57 @@ GEM thor (>= 0.18.1, < 2.0) rainbow (3.0.0) rake (12.3.1) - ransack (1.8.7) - actionpack (>= 3.0) - activerecord (>= 3.0) - activesupport (>= 3.0) + ransack (1.8.9) + actionpack (>= 3.0, <= 5.1.1) + activerecord (>= 3.0, <= 5.1.1) + activesupport (>= 3.0, <= 5.1.1) i18n - polyamorous (~> 1.3.2) rb-fsevent (0.10.3) rb-inotify (0.9.10) ffi (>= 0.5.0, < 2) - rdoc (6.0.1) rest-client (2.0.2) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) netrc (~> 0.8) - rspec (3.7.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-autotest (1.0.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-autotest (1.0.2) rspec-core (>= 2.99.0.beta1, < 4.0.0) - rspec-core (3.7.1) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-rails (3.7.2) + rspec-support (~> 3.8.0) + rspec-rails (3.8.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.1) - rubocop (0.53.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + rubocop (0.59.0) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5) + parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) - rubocop-rspec (1.24.0) - rubocop (>= 0.53.0) - ruby-progressbar (1.9.0) + rubocop-rspec (1.29.1) + rubocop (>= 0.58.0) + ruby-progressbar (1.10.0) rubytree (1.0.0) json (~> 2.1) structured_warnings (~> 0.3) - rubyzip (1.2.1) - sass (3.5.6) + rubyzip (1.2.2) + sass (3.5.7) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) @@ -313,13 +306,11 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sdoc (1.0.0) - rdoc (>= 5.0) - selenium-webdriver (3.13.0) + selenium-webdriver (3.14.0) childprocess (~> 0.5) rubyzip (~> 1.2) - simplecov (0.15.1) - docile (~> 1.1.0) + simplecov (0.16.1) + docile (~> 1.1) json (>= 1.8, < 3) simplecov-html (~> 0.10.0) simplecov-html (0.10.2) @@ -330,7 +321,7 @@ GEM actionpack (>= 3.1) railties (>= 3.1) slim (~> 3.0) - sorcery (0.11.0) + sorcery (0.12.0) bcrypt (~> 3.1) oauth (~> 0.4, >= 0.4.4) oauth2 (~> 1.0, >= 0.8.0) @@ -343,7 +334,7 @@ GEM actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - sshkit (1.16.0) + sshkit (1.17.0) net-scp (>= 1.1.2) net-ssh (>= 2.8.0) structured_warnings (0.3.0) @@ -358,17 +349,17 @@ GEM coffee-rails tzinfo (1.2.5) thread_safe (~> 0.1) - uglifier (4.1.6) + uglifier (4.1.18) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.3.0) + unicode-display_width (1.4.0) web-console (3.3.0) activemodel (>= 4.2) debug_inspector railties (>= 4.2) - websocket (1.2.5) + websocket (1.2.8) websocket-driver (0.7.0) websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) @@ -382,15 +373,12 @@ PLATFORMS ruby DEPENDENCIES - activerecord-deprecated_finders - activerecord-jdbcpostgresql-adapter autotest-rails bcrypt better_errors binding_of_caller bootstrap-will_paginate - bootstrap_pagedown (>= 1.1.0) - byebug + bootstrap_pagedown capistrano capistrano-rails capistrano-rvm @@ -401,7 +389,6 @@ DEPENDENCIES carrierwave codeclimate-test-reporter concurrent-ruby - concurrent-ruby-ext d3-rails (~> 4.0) database_cleaner docker-api @@ -420,7 +407,6 @@ DEPENDENCIES newrelic_rpm nokogiri nyan-cat-formatter - pagedown-rails pg (< 1.0) pry-byebug puma @@ -428,7 +414,6 @@ DEPENDENCIES rack-mini-profiler rails (= 4.2.10) rails-i18n - rake ransack rest-client rspec-autotest @@ -438,18 +423,15 @@ DEPENDENCIES rubytree rubyzip sass-rails (>= 5.0.7) - sdoc simplecov slim-rails sorcery spring - thread_safe tubesock turbolinks (< 5.0.0) uglifier web-console whenever - will_paginate BUNDLED WITH - 1.16.1 + 1.16.3 diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 9ccb9815..22b06a61 100644 --- a/app/assets/javascripts/application.js +++ b/app/assets/javascripts/application.js @@ -23,7 +23,4 @@ //= require_tree ../../../lib //= require_tree . //= require bootstrap_pagedown -//= require markdown.converter -//= require markdown.sanitizer -//= require markdown.editor //= require ace/ext-language_tools \ No newline at end of file diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 47163008..e21a40df 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -15,5 +15,4 @@ *= require_tree ../../../vendor/assets/stylesheets/ *= require_self *= require bootstrap_pagedown - *= require markdown */ diff --git a/lib/docker_container_pool.rb b/lib/docker_container_pool.rb index a2dc1a2e..64cd847c 100644 --- a/lib/docker_container_pool.rb +++ b/lib/docker_container_pool.rb @@ -4,9 +4,9 @@ require 'concurrent/timer_task' class DockerContainerPool - @containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }] + @containers = Concurrent::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, Concurrent::Array.new] }] #as containers are not containing containers in use - @all_containers = ThreadSafe::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, ThreadSafe::Array.new] }] + @all_containers = Concurrent::Hash[ExecutionEnvironment.all.map { |execution_environment| [execution_environment.id, Concurrent::Array.new] }] def self.clean_up Rails.logger.info('Container Pool is now performing a cleanup. ') diff --git a/spec/lib/docker_container_pool_spec.rb b/spec/lib/docker_container_pool_spec.rb index 1ff39657..b6f6f42f 100644 --- a/spec/lib/docker_container_pool_spec.rb +++ b/spec/lib/docker_container_pool_spec.rb @@ -14,8 +14,8 @@ describe DockerContainerPool do end it 'uses thread-safe data structures' do - expect(described_class.instance_variable_get(:@containers)).to be_a(ThreadSafe::Hash) - expect(described_class.instance_variable_get(:@containers)[@execution_environment.id]).to be_a(ThreadSafe::Array) + expect(described_class.instance_variable_get(:@containers)).to be_a(Concurrent::Hash) + expect(described_class.instance_variable_get(:@containers)[@execution_environment.id]).to be_a(Concurrent::Array) end describe '.clean_up' do From 1f12b39731a99a3a92ec569141f7d2cd12085a89 Mon Sep 17 00:00:00 2001 From: Sebastian Serth Date: Tue, 11 Sep 2018 10:53:58 +0200 Subject: [PATCH 02/38] Hide FactoryBot deprecation warning by changing static assignment Signed-off-by: Sebastian Serth --- spec/factories/code_ocean/file.rb | 8 +- spec/factories/consumer.rb | 2 +- spec/factories/error.rb | 2 +- spec/factories/execution_environment.rb | 140 +++++++++++------------ spec/factories/exercise.rb | 56 ++++----- spec/factories/file_type.rb | 130 ++++++++++----------- spec/factories/hint.rb | 74 ++++++------ spec/factories/internal_user.rb | 10 +- spec/factories/lti_parameter.rb | 4 +- spec/factories/proxy_exercise.rb | 4 +- spec/factories/submission.rb | 2 +- spec/factories/user_exercise_feedback.rb | 2 +- 12 files changed, 217 insertions(+), 217 deletions(-) diff --git a/spec/factories/code_ocean/file.rb b/spec/factories/code_ocean/file.rb index bc672045..186ad1d1 100644 --- a/spec/factories/code_ocean/file.rb +++ b/spec/factories/code_ocean/file.rb @@ -3,13 +3,13 @@ require 'seeds_helper' module CodeOcean FactoryBot.define do factory :file, class: CodeOcean::File do - content '' + content { '' } association :context, factory: :submission association :file_type, factory: :dot_rb - hidden false + hidden { false } name { SecureRandom.hex } - read_only false - role 'main_file' + read_only { false } + role { 'main_file' } end end end diff --git a/spec/factories/consumer.rb b/spec/factories/consumer.rb index a4f32ca8..59b05b8d 100644 --- a/spec/factories/consumer.rb +++ b/spec/factories/consumer.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :consumer do - name 'openHPI' + name { 'openHPI' } oauth_key { SecureRandom.hex } oauth_secret { SecureRandom.hex } singleton_consumer diff --git a/spec/factories/error.rb b/spec/factories/error.rb index c10d47bf..427fee7d 100644 --- a/spec/factories/error.rb +++ b/spec/factories/error.rb @@ -1,6 +1,6 @@ FactoryBot.define do factory :error, class: Error do association :execution_environment, factory: :ruby - message "exercise.rb:4:in `
': undefined local variable or method `foo' for main:Object (NameError)" + message { "exercise.rb:4:in `
': undefined local variable or method `foo' for main:Object (NameError)" } end end diff --git a/spec/factories/execution_environment.rb b/spec/factories/execution_environment.rb index 013a041b..7eaaa49b 100644 --- a/spec/factories/execution_environment.rb +++ b/spec/factories/execution_environment.rb @@ -2,146 +2,146 @@ FactoryBot.define do factory :coffee_script, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-coffee:latest' + docker_image { 'hklement/ubuntu-coffee:latest' } association :file_type, factory: :dot_coffee help - name 'CoffeeScript' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'coffee' + name { 'CoffeeScript' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'coffee' } singleton_execution_environment end factory :html, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-html:latest' + docker_image { 'hklement/ubuntu-html:latest' } association :file_type, factory: :dot_html help - name 'HTML5' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'touch' + name { 'HTML5' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'touch' } singleton_execution_environment - test_command 'rspec %{filename} --format documentation' - testing_framework 'RspecAdapter' + test_command { 'rspec %{filename} --format documentation' } + testing_framework { 'RspecAdapter' } end factory :java, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'openhpi/co_execenv_java:latest' + docker_image { 'openhpi/co_execenv_java:latest' } association :file_type, factory: :dot_java help - name 'Java 8' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'make run' + name { 'Java 8' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'make run' } singleton_execution_environment - test_command 'make test CLASS_NAME="%{class_name}" FILENAME="%{filename}"' - testing_framework 'JunitAdapter' + test_command { 'make test CLASS_NAME="%{class_name}" FILENAME="%{filename}"' } + testing_framework { 'JunitAdapter' } end factory :jruby, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-jruby:latest' + docker_image { 'hklement/ubuntu-jruby:latest' } association :file_type, factory: :dot_rb help - name 'JRuby 1.7' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'jruby %{filename}' + name { 'JRuby 1.7' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'jruby %{filename}' } singleton_execution_environment - test_command 'rspec %{filename} --format documentation' - testing_framework 'RspecAdapter' + test_command { 'rspec %{filename} --format documentation' } + testing_framework { 'RspecAdapter' } end factory :node_js, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-node:latest' + docker_image { 'hklement/ubuntu-node:latest' } association :file_type, factory: :dot_js help - name 'Node.js' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'node %{filename}' + name { 'Node.js' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'node %{filename}' } singleton_execution_environment end factory :python, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'openhpi/co_execenv_python:latest' + docker_image { 'openhpi/co_execenv_python:latest' } association :file_type, factory: :dot_py help - name 'Python 3.4' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'python3 %{filename}' + name { 'Python 3.4' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'python3 %{filename}' } singleton_execution_environment - test_command 'python3 -m unittest --verbose %{module_name}' - testing_framework 'PyUnitAdapter' + test_command { 'python3 -m unittest --verbose %{module_name}' } + testing_framework { 'PyUnitAdapter' } end factory :ruby, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-ruby:latest' + docker_image { 'hklement/ubuntu-ruby:latest' } association :file_type, factory: :dot_rb help - name 'Ruby 2.2' - network_enabled false - permitted_execution_time 10.seconds - pool_size 0 - run_command 'ruby %{filename}' + name { 'Ruby 2.2' } + network_enabled { false } + permitted_execution_time { 10.seconds } + pool_size { 0 } + run_command { 'ruby %{filename}' } singleton_execution_environment - test_command 'rspec %{filename} --format documentation' - testing_framework 'RspecAdapter' + test_command { 'rspec %{filename} --format documentation' } + testing_framework { 'RspecAdapter' } end factory :sinatra, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-sinatra:latest' + docker_image { 'hklement/ubuntu-sinatra:latest' } association :file_type, factory: :dot_rb - exposed_ports '4567' + exposed_ports { '4567' } help - name 'Sinatra' - network_enabled true - permitted_execution_time 15.minutes - pool_size 0 - run_command 'ruby %{filename}' + name { 'Sinatra' } + network_enabled { true } + permitted_execution_time { 15.minutes } + pool_size { 0 } + run_command { 'ruby %{filename}' } singleton_execution_environment - test_command 'rspec %{filename} --format documentation' - testing_framework 'RspecAdapter' + test_command { 'rspec %{filename} --format documentation' } + testing_framework { 'RspecAdapter' } end factory :sqlite, class: ExecutionEnvironment do created_by_teacher default_memory_limit - docker_image 'hklement/ubuntu-sqlite:latest' + docker_image { 'hklement/ubuntu-sqlite:latest' } association :file_type, factory: :dot_sql help - name 'SQLite' - network_enabled false - permitted_execution_time 1.minute - pool_size 0 - run_command 'sqlite3 /database.db -init %{filename} -html' + name { 'SQLite' } + network_enabled { false } + permitted_execution_time { 1.minute } + pool_size { 0 } + run_command { 'sqlite3 /database.db -init %{filename} -html' } singleton_execution_environment - test_command 'ruby %{filename}' - testing_framework 'SqlResultSetComparatorAdapter' + test_command { 'ruby %{filename}' } + testing_framework { 'SqlResultSetComparatorAdapter' } end trait :default_memory_limit do - memory_limit DockerClient::DEFAULT_MEMORY_LIMIT + memory_limit { DockerClient::DEFAULT_MEMORY_LIMIT } end trait :help do diff --git a/spec/factories/exercise.rb b/spec/factories/exercise.rb index 2fcd7e07..92ed180f 100644 --- a/spec/factories/exercise.rb +++ b/spec/factories/exercise.rb @@ -16,10 +16,10 @@ end FactoryBot.define do factory :audio_video, class: Exercise do created_by_teacher - description "Try HTML's audio and video capabilities." + description { "Try HTML's audio and video capabilities." } association :execution_environment, factory: :html - instructions 'Build a simple website including an HTML