Hide FactoryBot deprecation warning by changing static assignment

Signed-off-by: Sebastian Serth <Sebastian.Serth@student.hpi.de>
This commit is contained in:
Sebastian Serth
2018-09-11 10:53:58 +02:00
parent ac31afbd2a
commit 1f12b39731
12 changed files with 217 additions and 217 deletions

View File

@ -3,13 +3,13 @@ require 'seeds_helper'
module CodeOcean module CodeOcean
FactoryBot.define do FactoryBot.define do
factory :file, class: CodeOcean::File do factory :file, class: CodeOcean::File do
content '' content { '' }
association :context, factory: :submission association :context, factory: :submission
association :file_type, factory: :dot_rb association :file_type, factory: :dot_rb
hidden false hidden { false }
name { SecureRandom.hex } name { SecureRandom.hex }
read_only false read_only { false }
role 'main_file' role { 'main_file' }
end end
end end
end end

View File

@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :consumer do factory :consumer do
name 'openHPI' name { 'openHPI' }
oauth_key { SecureRandom.hex } oauth_key { SecureRandom.hex }
oauth_secret { SecureRandom.hex } oauth_secret { SecureRandom.hex }
singleton_consumer singleton_consumer

View File

@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :error, class: Error do factory :error, class: Error do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
message "exercise.rb:4:in `<main>': undefined local variable or method `foo' for main:Object (NameError)" message { "exercise.rb:4:in `<main>': undefined local variable or method `foo' for main:Object (NameError)" }
end end
end end

View File

@ -2,146 +2,146 @@ FactoryBot.define do
factory :coffee_script, class: ExecutionEnvironment do factory :coffee_script, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-coffee:latest' docker_image { 'hklement/ubuntu-coffee:latest' }
association :file_type, factory: :dot_coffee association :file_type, factory: :dot_coffee
help help
name 'CoffeeScript' name { 'CoffeeScript' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'coffee' run_command { 'coffee' }
singleton_execution_environment singleton_execution_environment
end end
factory :html, class: ExecutionEnvironment do factory :html, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-html:latest' docker_image { 'hklement/ubuntu-html:latest' }
association :file_type, factory: :dot_html association :file_type, factory: :dot_html
help help
name 'HTML5' name { 'HTML5' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'touch' run_command { 'touch' }
singleton_execution_environment singleton_execution_environment
test_command 'rspec %{filename} --format documentation' test_command { 'rspec %{filename} --format documentation' }
testing_framework 'RspecAdapter' testing_framework { 'RspecAdapter' }
end end
factory :java, class: ExecutionEnvironment do factory :java, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'openhpi/co_execenv_java:latest' docker_image { 'openhpi/co_execenv_java:latest' }
association :file_type, factory: :dot_java association :file_type, factory: :dot_java
help help
name 'Java 8' name { 'Java 8' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'make run' run_command { 'make run' }
singleton_execution_environment singleton_execution_environment
test_command 'make test CLASS_NAME="%{class_name}" FILENAME="%{filename}"' test_command { 'make test CLASS_NAME="%{class_name}" FILENAME="%{filename}"' }
testing_framework 'JunitAdapter' testing_framework { 'JunitAdapter' }
end end
factory :jruby, class: ExecutionEnvironment do factory :jruby, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-jruby:latest' docker_image { 'hklement/ubuntu-jruby:latest' }
association :file_type, factory: :dot_rb association :file_type, factory: :dot_rb
help help
name 'JRuby 1.7' name { 'JRuby 1.7' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'jruby %{filename}' run_command { 'jruby %{filename}' }
singleton_execution_environment singleton_execution_environment
test_command 'rspec %{filename} --format documentation' test_command { 'rspec %{filename} --format documentation' }
testing_framework 'RspecAdapter' testing_framework { 'RspecAdapter' }
end end
factory :node_js, class: ExecutionEnvironment do factory :node_js, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-node:latest' docker_image { 'hklement/ubuntu-node:latest' }
association :file_type, factory: :dot_js association :file_type, factory: :dot_js
help help
name 'Node.js' name { 'Node.js' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'node %{filename}' run_command { 'node %{filename}' }
singleton_execution_environment singleton_execution_environment
end end
factory :python, class: ExecutionEnvironment do factory :python, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'openhpi/co_execenv_python:latest' docker_image { 'openhpi/co_execenv_python:latest' }
association :file_type, factory: :dot_py association :file_type, factory: :dot_py
help help
name 'Python 3.4' name { 'Python 3.4' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'python3 %{filename}' run_command { 'python3 %{filename}' }
singleton_execution_environment singleton_execution_environment
test_command 'python3 -m unittest --verbose %{module_name}' test_command { 'python3 -m unittest --verbose %{module_name}' }
testing_framework 'PyUnitAdapter' testing_framework { 'PyUnitAdapter' }
end end
factory :ruby, class: ExecutionEnvironment do factory :ruby, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-ruby:latest' docker_image { 'hklement/ubuntu-ruby:latest' }
association :file_type, factory: :dot_rb association :file_type, factory: :dot_rb
help help
name 'Ruby 2.2' name { 'Ruby 2.2' }
network_enabled false network_enabled { false }
permitted_execution_time 10.seconds permitted_execution_time { 10.seconds }
pool_size 0 pool_size { 0 }
run_command 'ruby %{filename}' run_command { 'ruby %{filename}' }
singleton_execution_environment singleton_execution_environment
test_command 'rspec %{filename} --format documentation' test_command { 'rspec %{filename} --format documentation' }
testing_framework 'RspecAdapter' testing_framework { 'RspecAdapter' }
end end
factory :sinatra, class: ExecutionEnvironment do factory :sinatra, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-sinatra:latest' docker_image { 'hklement/ubuntu-sinatra:latest' }
association :file_type, factory: :dot_rb association :file_type, factory: :dot_rb
exposed_ports '4567' exposed_ports { '4567' }
help help
name 'Sinatra' name { 'Sinatra' }
network_enabled true network_enabled { true }
permitted_execution_time 15.minutes permitted_execution_time { 15.minutes }
pool_size 0 pool_size { 0 }
run_command 'ruby %{filename}' run_command { 'ruby %{filename}' }
singleton_execution_environment singleton_execution_environment
test_command 'rspec %{filename} --format documentation' test_command { 'rspec %{filename} --format documentation' }
testing_framework 'RspecAdapter' testing_framework { 'RspecAdapter' }
end end
factory :sqlite, class: ExecutionEnvironment do factory :sqlite, class: ExecutionEnvironment do
created_by_teacher created_by_teacher
default_memory_limit default_memory_limit
docker_image 'hklement/ubuntu-sqlite:latest' docker_image { 'hklement/ubuntu-sqlite:latest' }
association :file_type, factory: :dot_sql association :file_type, factory: :dot_sql
help help
name 'SQLite' name { 'SQLite' }
network_enabled false network_enabled { false }
permitted_execution_time 1.minute permitted_execution_time { 1.minute }
pool_size 0 pool_size { 0 }
run_command 'sqlite3 /database.db -init %{filename} -html' run_command { 'sqlite3 /database.db -init %{filename} -html' }
singleton_execution_environment singleton_execution_environment
test_command 'ruby %{filename}' test_command { 'ruby %{filename}' }
testing_framework 'SqlResultSetComparatorAdapter' testing_framework { 'SqlResultSetComparatorAdapter' }
end end
trait :default_memory_limit do trait :default_memory_limit do
memory_limit DockerClient::DEFAULT_MEMORY_LIMIT memory_limit { DockerClient::DEFAULT_MEMORY_LIMIT }
end end
trait :help do trait :help do

View File

@ -16,10 +16,10 @@ end
FactoryBot.define do FactoryBot.define do
factory :audio_video, class: Exercise do factory :audio_video, class: Exercise 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|
create_seed_file(exercise, 'audio_video/index.html', role: 'main_file') create_seed_file(exercise, 'audio_video/index.html', role: 'main_file')
@ -34,16 +34,16 @@ FactoryBot.define do
factory :dummy, class: Exercise do factory :dummy, class: Exercise do
created_by_teacher created_by_teacher
description 'Dummy' description { 'Dummy' }
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
instructions instructions
title 'Dummy' title { 'Dummy' }
factory :dummy_with_user_feedbacks do factory :dummy_with_user_feedbacks do
# user_feedbacks_count is declared as a transient attribute and available in # user_feedbacks_count is declared as a transient attribute and available in
# attributes on the factory, as well as the callback via the evaluator # attributes on the factory, as well as the callback via the evaluator
transient do transient do
user_feedbacks_count 5 user_feedbacks_count { 5 }
end end
# the after(:create) yields two values; the exercise instance itself and the # the after(:create) yields two values; the exercise instance itself and the
@ -60,10 +60,10 @@ FactoryBot.define do
factory :even_odd, class: Exercise do factory :even_odd, class: Exercise do
created_by_teacher created_by_teacher
description 'Implement two methods even and odd which return whether a given number is even or odd, respectively.' description { 'Implement two methods even and odd which return whether a given number is even or odd, respectively.' }
association :execution_environment, factory: :python association :execution_environment, factory: :python
instructions instructions
title 'Even/Odd' title { 'Even/Odd' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'even_odd/exercise.py', role: 'main_file') create_seed_file(exercise, 'even_odd/exercise.py', role: 'main_file')
@ -74,10 +74,10 @@ FactoryBot.define do
factory :fibonacci, class: Exercise do factory :fibonacci, class: Exercise do
created_by_teacher created_by_teacher
description 'Implement a recursive function that calculates a requested Fibonacci number.' description { 'Implement a recursive function that calculates a requested Fibonacci number.' }
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
instructions instructions
title 'Fibonacci Sequence' title { 'Fibonacci Sequence' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'fibonacci/exercise.rb', role: 'main_file') create_seed_file(exercise, 'fibonacci/exercise.rb', role: 'main_file')
@ -90,10 +90,10 @@ FactoryBot.define do
factory :files, class: Exercise do factory :files, class: Exercise do
created_by_teacher created_by_teacher
description 'Learn how to work with files.' description { 'Learn how to work with files.' }
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
instructions instructions
title 'Working with Files' title { 'Working with Files' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'files/data.txt', read_only: true) create_seed_file(exercise, 'files/data.txt', read_only: true)
@ -104,10 +104,10 @@ FactoryBot.define do
factory :geolocation, class: Exercise do factory :geolocation, class: Exercise do
created_by_teacher created_by_teacher
description "Use the HTML5 Geolocation API to get the user's geographical position." description { "Use the HTML5 Geolocation API to get the user's geographical position." }
association :execution_environment, factory: :html association :execution_environment, factory: :html
instructions instructions
title 'Geolocation' title { 'Geolocation' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'geolocation/index.html', role: 'main_file') create_seed_file(exercise, 'geolocation/index.html', role: 'main_file')
@ -117,10 +117,10 @@ FactoryBot.define do
factory :hello_world, class: Exercise do factory :hello_world, class: Exercise do
created_by_teacher created_by_teacher
description "Write a simple 'Hello World' application." description { "Write a simple 'Hello World' application." }
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
instructions instructions
title 'Hello World' title { 'Hello World' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'hello_world/exercise.rb', role: 'main_file') create_seed_file(exercise, 'hello_world/exercise.rb', role: 'main_file')
@ -130,10 +130,10 @@ FactoryBot.define do
factory :math, class: Exercise do factory :math, class: Exercise do
created_by_teacher created_by_teacher
description 'Implement a recursive math library.' description { 'Implement a recursive math library.' }
association :execution_environment, factory: :java association :execution_environment, factory: :java
instructions instructions
title 'Math' title { 'Math' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'math/Makefile', file_type: :makefile, hidden: true, role: 'regular_file') create_seed_file(exercise, 'math/Makefile', file_type: :makefile, hidden: true, role: 'regular_file')
@ -145,10 +145,10 @@ FactoryBot.define do
factory :primes, class: Exercise do factory :primes, class: Exercise do
created_by_teacher created_by_teacher
description 'Write a function that prints the first n prime numbers.' description { 'Write a function that prints the first n prime numbers.' }
association :execution_environment, factory: :node_js association :execution_environment, factory: :node_js
instructions instructions
title 'Primes' title { 'Primes' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'primes/exercise.js', role: 'main_file') create_seed_file(exercise, 'primes/exercise.js', role: 'main_file')
@ -157,10 +157,10 @@ FactoryBot.define do
factory :sql_select, class: Exercise do factory :sql_select, class: Exercise do
created_by_teacher created_by_teacher
description 'Learn to use the SELECT statement.' description { 'Learn to use the SELECT statement.' }
association :execution_environment, factory: :sqlite association :execution_environment, factory: :sqlite
instructions "Write a query which selects the full rows for all people with the last name 'Doe'." instructions { "Write a query which selects the full rows for all people with the last name 'Doe'." }
title 'SELECT' title { 'SELECT' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'sql_select/exercise.sql', role: 'main_file') create_seed_file(exercise, 'sql_select/exercise.sql', role: 'main_file')
@ -171,10 +171,10 @@ FactoryBot.define do
factory :tdd, class: Exercise do factory :tdd, class: Exercise do
created_by_teacher created_by_teacher
description 'Learn to appreciate test-driven development.' description { 'Learn to appreciate test-driven development.' }
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
instructions SeedsHelper.read_seed_file('tdd/instructions.md') instructions { SeedsHelper.read_seed_file('tdd/instructions.md') }
title 'Test-driven Development' title { 'Test-driven Development' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'tdd/exercise.rb', role: 'main_file') create_seed_file(exercise, 'tdd/exercise.rb', role: 'main_file')
@ -184,10 +184,10 @@ FactoryBot.define do
factory :web_app, class: Exercise do factory :web_app, class: Exercise do
created_by_teacher created_by_teacher
description 'Build a simple Web application with Sinatra.' description { 'Build a simple Web application with Sinatra.' }
association :execution_environment, factory: :sinatra association :execution_environment, factory: :sinatra
instructions instructions
title 'A Simple Web Application' title { 'A Simple Web Application' }
after(:create) do |exercise| after(:create) do |exercise|
create_seed_file(exercise, 'web_app/app.rb', role: 'main_file') create_seed_file(exercise, 'web_app/app.rb', role: 'main_file')

View File

@ -1,86 +1,86 @@
FactoryBot.define do FactoryBot.define do
factory :dot_coffee, class: FileType do factory :dot_coffee, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/coffee' editor_mode { 'ace/mode/coffee' }
executable executable
file_extension '.coffee' file_extension { '.coffee' }
indent_size 2 indent_size { 2 }
name 'CoffeeScript' name { 'CoffeeScript' }
singleton_file_type singleton_file_type
end end
factory :dot_gif, class: FileType do factory :dot_gif, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.gif' file_extension { '.gif' }
name 'GIF' name { 'GIF' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_html, class: FileType do factory :dot_html, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/html' editor_mode { 'ace/mode/html' }
file_extension '.html' file_extension { '.html' }
indent_size 4 indent_size { 4 }
name 'HTML' name { 'HTML' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_java, class: FileType do factory :dot_java, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/java' editor_mode { 'ace/mode/java' }
executable executable
file_extension '.java' file_extension { '.java' }
indent_size 4 indent_size { 4 }
name 'Java' name { 'Java' }
singleton_file_type singleton_file_type
end end
factory :dot_jpg, class: FileType do factory :dot_jpg, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.jpg' file_extension { '.jpg' }
name 'JPEG' name { 'JPEG' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_js, class: FileType do factory :dot_js, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/javascript' editor_mode { 'ace/mode/javascript' }
executable executable
file_extension '.js' file_extension { '.js' }
indent_size 4 indent_size { 4 }
name 'JavaScript' name { 'JavaScript' }
singleton_file_type singleton_file_type
end end
factory :dot_json, class: FileType do factory :dot_json, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/javascript' editor_mode { 'ace/mode/javascript' }
file_extension '.json' file_extension { '.json' }
indent_size 4 indent_size { 4 }
name 'JSON' name { 'JSON' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_md, class: FileType do factory :dot_md, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/markdown' editor_mode { 'ace/mode/markdown' }
file_extension '.md' file_extension { '.md' }
indent_size 2 indent_size { 2 }
name 'Markdown' name { 'Markdown' }
singleton_file_type singleton_file_type
end end
factory :dot_mp3, class: FileType do factory :dot_mp3, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.mp3' file_extension { '.mp3' }
name 'MP3' name { 'MP3' }
renderable renderable
singleton_file_type singleton_file_type
end end
@ -88,8 +88,8 @@ FactoryBot.define do
factory :dot_mp4, class: FileType do factory :dot_mp4, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.mp4' file_extension { '.mp4' }
name 'MPEG-4' name { 'MPEG-4' }
renderable renderable
singleton_file_type singleton_file_type
end end
@ -97,8 +97,8 @@ FactoryBot.define do
factory :dot_ogg, class: FileType do factory :dot_ogg, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.ogg' file_extension { '.ogg' }
name 'Ogg Vorbis' name { 'Ogg Vorbis' }
renderable renderable
singleton_file_type singleton_file_type
end end
@ -106,58 +106,58 @@ FactoryBot.define do
factory :dot_png, class: FileType do factory :dot_png, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.png' file_extension { '.png' }
name 'PNG' name { 'PNG' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_py, class: FileType do factory :dot_py, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/python' editor_mode { 'ace/mode/python' }
executable executable
file_extension '.py' file_extension { '.py' }
indent_size 4 indent_size { 4 }
name 'Python' name { 'Python' }
singleton_file_type singleton_file_type
end end
factory :dot_rb, class: FileType do factory :dot_rb, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/ruby' editor_mode { 'ace/mode/ruby' }
executable executable
file_extension '.rb' file_extension { '.rb' }
indent_size 2 indent_size { 2 }
name 'Ruby' name { 'Ruby' }
singleton_file_type singleton_file_type
end end
factory :dot_svg, class: FileType do factory :dot_svg, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/svg' editor_mode { 'ace/mode/svg' }
file_extension '.svg' file_extension { '.svg' }
indent_size 4 indent_size { 4 }
name 'SVG' name { 'SVG' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_sql, class: FileType do factory :dot_sql, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/sql' editor_mode { 'ace/mode/sql' }
executable executable
file_extension '.sql' file_extension { '.sql' }
indent_size 4 indent_size { 4 }
name 'SQL' name { 'SQL' }
singleton_file_type singleton_file_type
end end
factory :dot_txt, class: FileType do factory :dot_txt, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/plain_text' editor_mode { 'ace/mode/plain_text' }
file_extension '.txt' file_extension { '.txt' }
indent_size 4 indent_size { 4 }
name 'Plain Text' name { 'Plain Text' }
renderable renderable
singleton_file_type singleton_file_type
end end
@ -165,28 +165,28 @@ FactoryBot.define do
factory :dot_webm, class: FileType do factory :dot_webm, class: FileType do
binary binary
created_by_admin created_by_admin
file_extension '.webm' file_extension { '.webm' }
name 'WebM' name { 'WebM' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :dot_xml, class: FileType do factory :dot_xml, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/xml' editor_mode { 'ace/mode/xml' }
file_extension '.xml' file_extension { '.xml' }
indent_size 4 indent_size { 4 }
name 'XML' name { 'XML' }
renderable renderable
singleton_file_type singleton_file_type
end end
factory :makefile, class: FileType do factory :makefile, class: FileType do
created_by_admin created_by_admin
editor_mode 'ace/mode/makefile' editor_mode { 'ace/mode/makefile' }
executable executable
indent_size 2 indent_size { 2 }
name 'Makefile' name { 'Makefile' }
singleton_file_type singleton_file_type
end end

View File

@ -2,100 +2,100 @@ FactoryBot.define do
factory :node_js_invalid_assignment, class: Hint do factory :node_js_invalid_assignment, class: Hint do
association :execution_environment, factory: :node_js association :execution_environment, factory: :node_js
english english
message 'There was an error with an assignment. Maybe you have to use the equality operator here.' message { 'There was an error with an assignment. Maybe you have to use the equality operator here.' }
name 'Invalid assignment' name { 'Invalid assignment' }
regular_expression 'Invalid left-hand side in assignment' regular_expression { 'Invalid left-hand side in assignment' }
end end
factory :node_js_reference_error, class: Hint do factory :node_js_reference_error, class: Hint do
association :execution_environment, factory: :node_js association :execution_environment, factory: :node_js
english english
message "'$1' is not defined." message { "'$1' is not defined." }
name 'ReferenceError' name { 'ReferenceError' }
regular_expression 'ReferenceError: (\w+) is not defined' regular_expression { 'ReferenceError: (\w+) is not defined' }
end end
factory :node_js_syntax_error, class: Hint do factory :node_js_syntax_error, class: Hint do
association :execution_environment, factory: :node_js association :execution_environment, factory: :node_js
english english
message 'You seem to have made a typo.' message { 'You seem to have made a typo.' }
name 'SyntaxError' name { 'SyntaxError' }
regular_expression 'SyntaxError: Unexpected token (\w+)' regular_expression { 'SyntaxError: Unexpected token (\w+)' }
end end
factory :ruby_load_error, class: Hint do factory :ruby_load_error, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message "The file '$1' cannot be found." message { "The file '$1' cannot be found." }
name 'LoadError' name { 'LoadError' }
regular_expression 'cannot load such file -- (\w+) (LoadError)' regular_expression { 'cannot load such file -- (\w+) (LoadError)' }
end end
factory :ruby_name_error_constant, class: Hint do factory :ruby_name_error_constant, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message "The constant '$1' is not defined." message { "The constant '$1' is not defined." }
name 'NameError (uninitialized constant)' name { 'NameError (uninitialized constant)' }
regular_expression 'uninitialized constant (\w+) \(NameError\)' regular_expression { 'uninitialized constant (\w+) \(NameError\)' }
end end
factory :ruby_name_error_variable, class: Hint do factory :ruby_name_error_variable, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message "Your object '$2' of class '$3' does not know what '$1' is. Maybe you made a typo or still have to define '$1'." message { "Your object '$2' of class '$3' does not know what '$1' is. Maybe you made a typo or still have to define '$1'." }
name 'NameError (undefined local variable or method)' name { 'NameError (undefined local variable or method)' }
regular_expression 'undefined local variable or method `(\w+)\' for (\w+):(\w+) \(NameError\)' regular_expression { 'undefined local variable or method `(\w+)\' for (\w+):(\w+) \(NameError\)' }
end end
factory :ruby_no_method_error, class: Hint do factory :ruby_no_method_error, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message "Your object '$2' of class '$3' does not understand the method '$1'. Maybe you made a typo or still have to implement that method." message { "Your object '$2' of class '$3' does not understand the method '$1'. Maybe you made a typo or still have to implement that method." }
name 'NoMethodError' name { 'NoMethodError' }
regular_expression 'undefined method `([\w\!\?=\[\]]+)\' for (\w+):(\w+) \(NoMethodError\)' regular_expression { 'undefined method `([\w\!\?=\[\]]+)\' for (\w+):(\w+) \(NoMethodError\)' }
end end
factory :ruby_syntax_error, class: Hint do factory :ruby_syntax_error, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message 'You seem to have made a typo.' message { 'You seem to have made a typo.' }
name 'SyntaxError' name { 'SyntaxError' }
regular_expression 'syntax error' regular_expression { 'syntax error' }
end end
factory :ruby_system_stack_error, class: Hint do factory :ruby_system_stack_error, class: Hint do
association :execution_environment, factory: :ruby association :execution_environment, factory: :ruby
english english
message 'You seem to have built an infinite loop or recursion.' message { 'You seem to have built an infinite loop or recursion.' }
name 'SystemStackError' name { 'SystemStackError' }
regular_expression 'stack level too deep \(SystemStackError\)' regular_expression { 'stack level too deep \(SystemStackError\)' }
end end
factory :sqlite_no_such_column, class: Hint do factory :sqlite_no_such_column, class: Hint do
association :execution_environment, factory: :sqlite association :execution_environment, factory: :sqlite
english english
message "The column '$1' does not exist." message { "The column '$1' does not exist." }
name 'No Such Column' name { 'No Such Column' }
regular_expression 'no such column: (\w+)' regular_expression { 'no such column: (\w+)' }
end end
factory :sqlite_no_such_table, class: Hint do factory :sqlite_no_such_table, class: Hint do
association :execution_environment, factory: :sqlite association :execution_environment, factory: :sqlite
english english
message "The table '$1' does not exist." message { "The table '$1' does not exist." }
name 'No Such Table' name { 'No Such Table' }
regular_expression 'no such table: (\w+)' regular_expression { 'no such table: (\w+)' }
end end
factory :sqlite_syntax_error, class: Hint do factory :sqlite_syntax_error, class: Hint do
association :execution_environment, factory: :sqlite association :execution_environment, factory: :sqlite
english english
message "You seem to have made a typo near '$1'." message { "You seem to have made a typo near '$1'." }
name 'SyntaxError' name { 'SyntaxError' }
regular_expression 'near "(\w+)": syntax error' regular_expression { 'near "(\w+)": syntax error' }
end end
trait :english do trait :english do
locale 'en' locale { 'en' }
end end
end end

View File

@ -1,10 +1,10 @@
FactoryBot.define do FactoryBot.define do
factory :admin, class: InternalUser do factory :admin, class: InternalUser do
activated_user activated_user
email 'admin@example.org' email { 'admin@example.org' }
generated_user_name generated_user_name
password 'admin' password { 'admin' }
role 'admin' role { 'admin' }
singleton_internal_user singleton_internal_user
end end
@ -13,8 +13,8 @@ FactoryBot.define do
association :consumer association :consumer
generated_email generated_email
generated_user_name generated_user_name
password 'teacher' password { 'teacher' }
role 'teacher' role { 'teacher' }
singleton_internal_user singleton_internal_user
end end

View File

@ -11,10 +11,10 @@ FactoryBot.define do
association :exercise, factory: :math association :exercise, factory: :math
association :external_user association :external_user
lti_parameters LTI_PARAMETERS lti_parameters { LTI_PARAMETERS }
trait :without_outcome_service_url do trait :without_outcome_service_url do
lti_parameters LTI_PARAMETERS.except(:lis_outcome_service_url) lti_parameters { LTI_PARAMETERS.except(:lis_outcome_service_url) }
end end
end end
end end

View File

@ -1,7 +1,7 @@
FactoryBot.define do FactoryBot.define do
factory :proxy_exercise, class: ProxyExercise do factory :proxy_exercise, class: ProxyExercise do
token 'dummytoken' token { 'dummytoken' }
title 'Dummy' title { 'Dummy' }
end end
end end

View File

@ -1,6 +1,6 @@
FactoryBot.define do FactoryBot.define do
factory :submission do factory :submission do
cause 'save' cause { 'save' }
created_by_external_user created_by_external_user
association :exercise, factory: :math association :exercise, factory: :math

View File

@ -1,7 +1,7 @@
FactoryBot.define do FactoryBot.define do
factory :user_exercise_feedback, class: UserExerciseFeedback do factory :user_exercise_feedback, class: UserExerciseFeedback do
created_by_external_user created_by_external_user
feedback_text 'Most suitable exercise ever' feedback_text { 'Most suitable exercise ever' }
association :exercise, factory: :math association :exercise, factory: :math
end end