- <% if assignment.has_documents? %>
+ <% if assignment.documents? %>
<%= render partial: 'media/medium/buttons',
locals: { medium: assignment.medium,
diff --git a/app/workers/cache_cleaner.rb b/app/workers/cache_cleaner.rb
index 6b77f4bf4..535704ca2 100644
--- a/app/workers/cache_cleaner.rb
+++ b/app/workers/cache_cleaner.rb
@@ -4,7 +4,7 @@ class CacheCleaner
def perform
submission_cache = Shrine.storages[:submission_cache]
media_cache = Shrine.storages[:cache]
- submission_cache.clear! { |path| path.mtime < Time.now - 1.week }
- media_cache.clear! { |path| path.mtime < Time.now - 1.week }
+ submission_cache.clear! { |path| path.mtime < 1.week.ago }
+ media_cache.clear! { |path| path.mtime < 1.week.ago }
end
end
diff --git a/app/workers/interaction_saver.rb b/app/workers/interaction_saver.rb
index ec89207ad..f6c95faf1 100644
--- a/app/workers/interaction_saver.rb
+++ b/app/workers/interaction_saver.rb
@@ -2,9 +2,9 @@ class InteractionSaver
include Sidekiq::Worker
def perform(session_id, full_path, referrer, study_participant)
- referrer_url = if referrer.to_s.include?(ENV['URL_HOST'])
- referrer.to_s.remove(ENV['URL_HOST'])
- .remove('https://').remove('http://')
+ referrer_url = if referrer.to_s.include?(ENV["URL_HOST"])
+ referrer.to_s.remove(ENV["URL_HOST"])
+ .remove("https://").remove("http://")
end
Interaction.create(session_id: Digest::SHA2.hexdigest(session_id).first(10),
full_path: full_path,
diff --git a/app/workers/media_publisher.rb b/app/workers/media_publisher.rb
index 17318e427..da607900f 100644
--- a/app/workers/media_publisher.rb
+++ b/app/workers/media_publisher.rb
@@ -5,6 +5,6 @@ def perform
media_ids = Medium.where.not(publisher: nil).pluck(:publisher)
.select { |p| p.release_date < DateTime.current }
.map(&:medium_id)
- Medium.where(id: media_ids).each(&:publish!)
+ Medium.where(id: media_ids).find_each(&:publish!)
end
end
diff --git a/app/workers/probe_saver.rb b/app/workers/probe_saver.rb
index 553f5399e..4d4eb7211 100644
--- a/app/workers/probe_saver.rb
+++ b/app/workers/probe_saver.rb
@@ -1,8 +1,10 @@
class ProbeSaver
include Sidekiq::Worker
+ # rubocop:todo Metrics/ParameterLists
def perform(quiz_id, question_id, remark_id, correct, progress, session_id,
study_participant, input)
+ # rubocop:enable Metrics/ParameterLists
probe = Probe.create(quiz_id: quiz_id,
question_id: question_id,
remark_id: remark_id,
diff --git a/app/workers/user_cleaner_job.rb b/app/workers/user_cleaner_job.rb
index 4c0187a89..4c20eb572 100644
--- a/app/workers/user_cleaner_job.rb
+++ b/app/workers/user_cleaner_job.rb
@@ -2,7 +2,7 @@ class UserCleanerJob
include Sidekiq::Worker
def perform
- user_cleaner = UserCleaner.new()
+ user_cleaner = UserCleaner.new
user_cleaner.clean!
end
end
diff --git a/config/application.rb b/config/application.rb
index 69d2fb63e..15040fd01 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,6 +1,6 @@
-require_relative 'boot'
+require_relative "boot"
-require 'rails/all'
+require "rails/all"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
@@ -9,12 +9,12 @@
module Mampf
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 7.0
+ config.load_defaults(7.0)
config.autoloader = :zeitwerk
config.i18n.default_locale = :de
config.i18n.fallbacks = [:en]
config.i18n.available_locales = [:de, :en]
- config.time_zone = 'Berlin'
+ config.time_zone = "Berlin"
# config.eager_load_paths << Rails.root.join("extras")
# Make `form_with` generate remote forms by default.
config.action_view.form_with_generates_remote_forms = true
@@ -23,20 +23,21 @@ class Application < Rails::Application
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.exception_handler = {
- email: ENV['ERROR_EMAIL'], # sends exception emails to a listed email (string // "you@email.com")
+ # sends exception emails to a listed email (string // "you@email.com")
+ email: ENV.fetch("ERROR_EMAIL", nil),
- # All keys interpolated as strings, so you can use symbols, strings or integers where necessary
+ # All keys interpolated as strings, so you can use
+ # symbols, strings or integers where necessary
exceptions: {
-
- all: {
+ all: {
layout: "application_no_sidebar", # define layout
notification: true # (false by default)
}
}
}
config.to_prepare do
- # some monkey patches for sidekiq-cron
- # see https://github.com/ondrejbartas/sidekiq-cron/issues/310
+ # some monkey patches for sidekiq-cron
+ # see https://github.com/ondrejbartas/sidekiq-cron/issues/310
Sidekiq::Cron::Job.class_eval do
def self.all
job_hashes = nil
@@ -62,4 +63,3 @@ def self.all
Commontator::Engine.config.autoload_once_paths = []
end
end
-
diff --git a/config/environment.rb b/config/environment.rb
index bc882650f..336dd862b 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,9 +1,9 @@
# Load the Rails application.
-require_relative 'application'
+require_relative "application"
# Load the app's custom environment variables here, so that they are loaded before environments/*.rb
-app_environment_variables = File.join(Rails.root, 'config', 'app_environment_variables.rb')
-load(app_environment_variables) if File.exists?(app_environment_variables)
+app_environment_variables = Rails.root.join("config/app_environment_variables.rb").to_s
+load(app_environment_variables) if File.exist?(app_environment_variables)
# Initialize the Rails application.
Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 9060f6591..2ce769377 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -14,13 +14,13 @@
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
+ if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -35,9 +35,10 @@
# Don't care if the mailer can't send.
config.action_mailer.perform_deliveries = true
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = { :address => ENV.fetch("MAILSERVER", '127.0.0.1'), :port => 1025 }
+ config.action_mailer.smtp_settings = { address: ENV.fetch("MAILSERVER", "127.0.0.1"),
+ port: 1025 }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
diff --git a/config/environments/docker_development.rb b/config/environments/docker_development.rb
index 541c16cb7..f2be5f19d 100644
--- a/config/environments/docker_development.rb
+++ b/config/environments/docker_development.rb
@@ -15,13 +15,13 @@
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
+ if Rails.root.join("tmp/caching-dev.txt").exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -36,9 +36,10 @@
# Don't care if the mailer can't send.
config.action_mailer.perform_deliveries = true
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
config.action_mailer.delivery_method = :smtp
- config.action_mailer.smtp_settings = { :address => ENV.fetch("MAILSERVER", '127.0.0.1'), :port => 1025 }
+ config.action_mailer.smtp_settings = { address: ENV.fetch("MAILSERVER", "127.0.0.1"),
+ port: 1025 }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_caching = false
@@ -76,18 +77,17 @@
# when problems arise.
config.log_level = :debug
- logger = ActiveSupport::Logger.new(STDOUT)
+ logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
# enable webconsole via docker
# see http://through-voidness.blogspot.com/2017/02/rails-5-web-console-and-docker-dev-env.html
- require 'socket'
- require 'ipaddr'
+ require "socket"
+ require "ipaddr"
config.web_console.allowed_ips = Socket.ip_address_list.reduce([]) do |res, addrinfo|
addrinfo.ipv4? ? res << IPAddr.new(addrinfo.ip_address).mask(24) : res
end
-
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 083188dc1..805b5c66e 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -20,7 +20,7 @@
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Compress CSS using a preprocessor.
config.assets.css_compressor = :sass
@@ -34,7 +34,7 @@
# Specifies the header that your server uses for sending files.
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
- config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+ config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
# Store uploaded files on the local file system (see config/storage.yml for options).
config.active_storage.service = :local
@@ -52,26 +52,26 @@
config.log_level = :warn
# Prepend all log lines with the following tags.
- config.log_tags = [ :request_id ]
+ config.log_tags = [:request_id]
# Use a different cache store in production.
- config.cache_store = :mem_cache_store, ENV["MEMCACHED_SERVER"]
+ config.cache_store = :mem_cache_store, ENV.fetch("MEMCACHED_SERVER", nil)
# Use a real queuing backend for Active Job (and separate queues per environment)
# config.active_job.queue_adapter = :resque
# config.active_job.queue_name_prefix = "mampf_#{Rails.env}"
config.action_mailer.perform_caching = false
- config.action_mailer.default_url_options = { protocol: 'https', host: ENV["URL_HOST"] }
+ config.action_mailer.default_url_options = { protocol: "https", host: ENV.fetch("URL_HOST", nil) }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = false
- config.action_mailer.default :charset => "utf-8"
+ config.action_mailer.default(charset: "utf-8")
config.action_mailer.smtp_settings = {
- address: ENV["MAILSERVER"],
+ address: ENV.fetch("MAILSERVER", nil),
port: 25,
- domain: ENV["MAILSERVER"],
+ domain: ENV.fetch("MAILSERVER", nil)
}
# Ignore bad email addresses and do not raise email delivery errors.
@@ -87,14 +87,14 @@
config.active_support.deprecation = :notify
# Use default logging formatter so that PID and timestamp are not suppressed.
- config.log_formatter = ::Logger::Formatter.new
+ config.log_formatter = Logger::Formatter.new
# Use a different logger for distributed setups.
# require 'syslog/logger'
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present?
- logger = ActiveSupport::Logger.new(STDOUT)
+ logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger)
end
@@ -120,5 +120,6 @@
# these configuration options.
# config.active_record.database_selector = { delay: 2.seconds }
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
+ # config.active_record.database_resolver_context = \
+ # ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
end
diff --git a/config/environments/test.rb b/config/environments/test.rb
index bba53d134..5ce664ab7 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -16,7 +16,7 @@
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
@@ -52,14 +52,14 @@
# Raises error for missing translations.
# config.i18n.raise_on_missing_translations = true
- # Don't care if the mailer can't send.
- config.action_mailer.perform_deliveries = true
- config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
- config.action_mailer.raise_delivery_errors = true
+ # Don't care if the mailer can't send.
+ config.action_mailer.perform_deliveries = true
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
+ config.action_mailer.raise_delivery_errors = true
- config.action_mailer.perform_caching = false
- config.i18n.default_locale = :de
+ config.action_mailer.perform_caching = false
+ config.i18n.default_locale = :de
- # Annotate rendered view with file names.
- # config.action_view.annotate_rendered_view_with_filenames = true
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
end
diff --git a/config/initializers/active_job.rb b/config/initializers/active_job.rb
index a7baf1845..ce7759ede 100644
--- a/config/initializers/active_job.rb
+++ b/config/initializers/active_job.rb
@@ -1 +1 @@
-Rails.application.config.active_job.queue_adapter = :sidekiq
\ No newline at end of file
+Rails.application.config.active_job.queue_adapter = :sidekiq
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 255dc72e5..1e912c9b3 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -1,26 +1,25 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
-Rails.application.config.assets.version = '1.0'
+Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
# Add Yarn node_modules folder to the asset load path.
-Rails.application.config.assets.paths << Rails.root.join('node_modules')
+Rails.application.config.assets.paths << Rails.root.join("node_modules")
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
# folder are already added.
# Rails.application.config.assets.precompile += %w( admin.js admin.css )
-Rails.application.config.assets.precompile += %w( thredded_katex.scss )
-Rails.application.config.assets.precompile += %w( thredded_timeago.js )
-Rails.application.config.assets.precompile += %w( show_clicker_assets.js)
-Rails.application.config.assets.precompile += %w( edit_clicker_assets.js)
-
+Rails.application.config.assets.precompile += ["thredded_katex.scss"]
+Rails.application.config.assets.precompile += ["thredded_timeago.js"]
+Rails.application.config.assets.precompile += ["show_clicker_assets.js"]
+Rails.application.config.assets.precompile += ["edit_clicker_assets.js"]
# fix concurrency issue that leads to occasional seg fault
# See https://github.com/sass/sassc-ruby/issues/207
-if Rails.env == 'test'
+if Rails.env.test?
Rails.application.configure do
config.assets.configure do |env|
env.export_concurrent = false
@@ -31,7 +30,7 @@
# Allow overriding of the sprockets cache path
# This is done to fix this problem:
# (https://github.com/rails/sprockets/issues/283#issuecomment-578728257)
-if Rails.env == 'docker_development'
+if Rails.env.docker_development?
Rails.application.config.assets.configure do |env|
env.cache = Sprockets::Cache::FileStore.new(
ENV.fetch("SPROCKETS_CACHE", "#{env.root}/tmp/cache/assets"),
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
index 33699c309..1e85ed877 100644
--- a/config/initializers/backtrace_silencers.rb
+++ b/config/initializers/backtrace_silencers.rb
@@ -1,8 +1,10 @@
# Be sure to restart your server when you modify this file.
-# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
+# You can add backtrace silencers for libraries that you're using but
+# don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
-# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
-# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
+# You can also remove all the silencers if you're trying to debug a problem
+# that might stem from framework code by setting BACKTRACE=1 before calling
+# your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]
diff --git a/config/initializers/bust_cache.rb b/config/initializers/bust_cache.rb
index 6694943f4..e50f21886 100644
--- a/config/initializers/bust_cache.rb
+++ b/config/initializers/bust_cache.rb
@@ -2,4 +2,4 @@
# https://ninjasandrobots.com/rails-caching-a-problem-with-etags-and-a-solution
# see also https://brandonhilkert.com/blog/understanding-the-rails-cache-id-environment-variable/
# Upon deployment, Rails cache gets busted
-ENV["RAILS_CACHE_ID"] = Time.now.to_s
+ENV["RAILS_CACHE_ID"] = Time.zone.now.to_s
diff --git a/config/initializers/commontator.rb b/config/initializers/commontator.rb
index c88cdd2af..78a775e9d 100644
--- a/config/initializers/commontator.rb
+++ b/config/initializers/commontator.rb
@@ -22,7 +22,8 @@
# through the view object (for example, view.flash)
# However, the view does not include the main application's helpers
# Default: ->(view) { '' }
- config.javascript_proc = ->(view) { "commentsCard = document.getElementById('commentsCard');
+ config.javascript_proc = lambda { |_view|
+ "commentsCard = document.getElementById('commentsCard');
renderMathInElement(commentsCard, {
delimiters: [
{
@@ -37,8 +38,8 @@
],
ignoredClasses: ['form-control', 'noTexStatus'],
throwOnError: false
-}); $('.subscriptionInfo').popover();" }
-
+}); $('.subscriptionInfo').popover();"
+ }
# User (acts_as_commontator) Configuration
@@ -58,7 +59,7 @@
# comments will become a hyperlink pointing to this path
# The main application's routes can be accessed through the app_routes object
# Default: ->(user, app_routes) { '' } (no link)
- config.user_link_proc = ->(user, app_routes) { '' }
+ config.user_link_proc = ->(_user, _app_routes) { "" }
# user_avatar_proc
# Type: Proc
@@ -76,9 +77,9 @@
# Default: ->(user, view) do
# # view.commontator_gravatar_image_tag(user, 1, s: 60, d: 'mm')
# end
- config.user_avatar_proc = ->(user, view) do
+ config.user_avatar_proc = lambda { |user, view|
# view.commontator_gravatar_image_tag(user, 1, s: 60, d: 'mm')
- end
+ }
# user_email_proc
# Type: Proc
@@ -90,7 +91,7 @@
# If the mailer argument is not nil, then Commontator intends to send an email to
# the address returned; you can prevent it from being sent by returning a blank String
# Default: ->(user, mailer) { user.try(:email) || '' }
- config.user_email_proc = ->(user, mailer) { user.try(:email) || '' }
+ config.user_email_proc = ->(user, _mailer) { user.try(:email) || "" }
# user_mentions_proc
# Type: Proc
@@ -112,10 +113,9 @@
# attribute being searched does not contain sensitive information.
#
# Default: ->(current_user, query) { current_user.class.where('username LIKE ?', "#{query}%") }
- config.user_mentions_proc = ->(current_user, thread, query) do
- current_user.class.where('username LIKE ?', "#{query}%")
- end
-
+ config.user_mentions_proc = lambda { |current_user, _thread, query|
+ current_user.class.where("username LIKE ?", "#{query}%")
+ }
# Thread/Commontable (acts_as_commontable) Configuration
@@ -137,7 +137,7 @@
# Returns: a Boolean, true if and only if the user should be allowed to read that thread
# Note: can be called with a user object that is nil (if they are not logged in)
# Default: ->(thread, user) { true } (anyone can read any thread)
- config.thread_read_proc = ->(thread, user) { true }
+ config.thread_read_proc = ->(_thread, _user) { true }
# thread_moderator_proc
# Type: Proc
@@ -145,7 +145,9 @@
# Returns: a Boolean, true if and only if the user is a moderator for that thread
# If you want global moderators, make this proc true for them regardless of thread
# Default: ->(thread, user) { false } (no moderators)
- config.thread_moderator_proc = ->(thread, user) { thread.commontable.edited_with_inheritance_by?(user) || user.admin? }
+ config.thread_moderator_proc = lambda { |thread, user|
+ thread.commontable.edited_with_inheritance_by?(user) || user.admin?
+ }
# comment_editing
# Type: Symbol
@@ -198,9 +200,9 @@
# Default: ->(thread, pos, neg) do
# ((thread.config.comment_voting == :ld ? '%+d' : '%d') % (pos - neg)).sub('+0', '0')
# end
- config.vote_count_proc = ->(thread, pos, neg) do
- ((thread.config.comment_voting == :ld ? '%+d' : '%d') % (pos - neg)).sub('+0', '0')
- end
+ config.vote_count_proc = lambda { |thread, pos, neg|
+ ((thread.config.comment_voting == :ld ? "%+d" : "%d") % (pos - neg)).sub("+0", "0")
+ }
# comment_order
# Type: Symbol
@@ -250,7 +252,7 @@
# The maximum number of comments loaded at once for the default setting is:
# 20 + 20*5 + 20*5*2 == 320
# Default: [ 20, 5, 2 ]
- config.comments_per_page = [ 20, 5, 2 ]
+ config.comments_per_page = [20, 5, 2]
# thread_subscription
# Type: Symbol
@@ -271,9 +273,9 @@
# Default: ->(thread) do
# "no-reply@#{Rails.application.class.module_parent.to_s.downcase}.com"
# end
- config.email_from_proc = ->(thread) do
+ config.email_from_proc = lambda { |_thread|
DefaultSetting::PROJECT_NOTIFICATION_EMAIL
- end
+ }
# commontable_name_proc
# Type: Proc
@@ -284,9 +286,9 @@
# Default: ->(thread) do
# "#{thread.commontable.class.name} ##{thread.commontable.id}"
# end
- config.commontable_name_proc = ->(thread) do
+ config.commontable_name_proc = lambda { |thread|
thread.commontable.title_for_viewers
- end
+ }
# comment_url_proc
# Type: Proc
@@ -299,9 +301,9 @@
# app_routes.polymorphic_url(comment.thread.commontable, anchor: "comment-#{comment.id}-div")
# end
# (defaults to the commontable's show url with an anchor pointing to the comment's div)
- config.comment_url_proc = ->(comment, app_routes) do
+ config.comment_url_proc = lambda { |comment, app_routes|
app_routes.polymorphic_url(comment.thread.commontable.becomes(Medium))
- end
+ }
# mentions_enabled
# Type: Boolean
diff --git a/config/initializers/core_ext.rb b/config/initializers/core_ext.rb
index 42be5dd0d..c6ca37696 100644
--- a/config/initializers/core_ext.rb
+++ b/config/initializers/core_ext.rb
@@ -1 +1 @@
-Dir[File.join(Rails.root, "lib", "core_ext", "*.rb")].each {|l| require l }
+Dir[Rails.root.join("lib/core_ext/*.rb").to_s].each { |l| require l }
diff --git a/config/initializers/customize_error.rb b/config/initializers/customize_error.rb
index 351ea48b8..04f74bc78 100644
--- a/config/initializers/customize_error.rb
+++ b/config/initializers/customize_error.rb
@@ -1,9 +1,9 @@
ActionView::Base.field_error_proc = proc do |html_tag, _instance|
- class_attr_index = html_tag.index 'class="'
+ class_attr_index = html_tag.index('class="')
if class_attr_index
- html_tag.insert class_attr_index + 7, 'is-invalid '
+ html_tag.insert(class_attr_index + 7, "is-invalid ")
else
- html_tag.insert html_tag.index('>'), ' class="is-invalid"'
+ html_tag.insert(html_tag.index(">"), ' class="is-invalid"')
end
-end
\ No newline at end of file
+end
diff --git a/config/initializers/cypress_on_rails.rb b/config/initializers/cypress_on_rails.rb
index e43587d79..223ed8e30 100644
--- a/config/initializers/cypress_on_rails.rb
+++ b/config/initializers/cypress_on_rails.rb
@@ -2,7 +2,8 @@
CypressOnRails.configure do |c|
c.cypress_folder = File.expand_path("#{__dir__}/../../spec/cypress")
# WARNING!! CypressOnRails can execute arbitrary ruby code
- # please use with extra caution if enabling on hosted servers or starting your local server on 0.0.0.0
+ # please use with extra caution if enabling on hosted servers
+ # or starting your local server on 0.0.0.0
c.use_middleware = Rails.env.test?
c.logger = Rails.logger
end
diff --git a/config/initializers/default_setting.rb b/config/initializers/default_setting.rb
index ec1aa667f..bdc25a5da 100644
--- a/config/initializers/default_setting.rb
+++ b/config/initializers/default_setting.rb
@@ -1,12 +1,12 @@
class DefaultSetting
- ERDBEERE_LINK = ENV['ERDBEERE_SERVER']
- MUESLI_LINK = ENV['MUESLI_SERVER']
- PROJECT_EMAIL = ENV['PROJECT_EMAIL']
- PROJECT_NOTIFICATION_EMAIL = ENV['PROJECT_NOTIFICATION_EMAIL']
- BLOG_LINK = ENV['BLOG']
- URL_HOST_SHORT = ENV['URL_HOST_SHORT']
- RESEARCHGATE_LINK = 'https://www.researchgate.net/project/MaMpf-Mathematische-Medienplattform'
- TOUR_LINK = 'https://mampf.blog/ueber-mampf/'
- RESOURCES_LINK = 'https://mampf.blog/ressourcen-fur-editorinnen/'
- MAMPF_STY_VERSION = '2.12'
+ ERDBEERE_LINK = ENV.fetch("ERDBEERE_SERVER", nil)
+ MUESLI_LINK = ENV.fetch("MUESLI_SERVER", nil)
+ PROJECT_EMAIL = ENV.fetch("PROJECT_EMAIL", nil)
+ PROJECT_NOTIFICATION_EMAIL = ENV.fetch("PROJECT_NOTIFICATION_EMAIL", nil)
+ BLOG_LINK = ENV.fetch("BLOG", nil)
+ URL_HOST_SHORT = ENV.fetch("URL_HOST_SHORT", nil)
+ RESEARCHGATE_LINK = "https://www.researchgate.net/project/MaMpf-Mathematische-Medienplattform".freeze
+ TOUR_LINK = "https://mampf.blog/ueber-mampf/".freeze
+ RESOURCES_LINK = "https://mampf.blog/ressourcen-fur-editorinnen/".freeze
+ MAMPF_STY_VERSION = "2.12".freeze
end
diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb
index acd408ff1..c3b179a48 100644
--- a/config/initializers/devise.rb
+++ b/config/initializers/devise.rb
@@ -6,25 +6,28 @@
# confirmation, reset password and unlock tokens in the database.
# Devise will use the `secret_key_base` as its `secret_key`
# by default. You can change it below and use your own secret key.
- # config.secret_key = 'e3db535c6b3d192daba97e1422738845124d55e3d8014e867f89c977e99c8fd887f25e456ec10a8489d148c5c508eec08b7a1db1deb40b51e2de0000685a7fe9'
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
- config.mailer_sender = Rails.env.production? ? ENV["FROM_ADDRESS"] : "please-change-me-at-config-initializers-devise@example.com"
+ config.mailer_sender = if Rails.env.production?
+ ENV.fetch("FROM_ADDRESS", nil)
+ else
+ "please-change-me-at-config-initializers-devise@example.com"
+ end
# Configure the class responsible to send e-mails.
- config.mailer = 'MyMailer'
+ config.mailer = "MyMailer"
# Configure the parent class responsible to send e-mails.
- config.parent_mailer = 'ActionMailer::Base'
+ config.parent_mailer = "ActionMailer::Base"
# ==> ORM configuration
# Load and configure the ORM. Supports :active_record (default) and
# :mongoid (bson_ext recommended) by default. Other ORMs may be
# available as additional gems.
- require 'devise/orm/active_record'
+ require "devise/orm/active_record"
# ==> Configuration for any authentication mechanism
# Configure which keys are used when authenticating a user. The default is
@@ -107,9 +110,6 @@
# a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
config.stretches = Rails.env.test? ? 1 : 11
- # Set up a pepper to generate the hashed password.
- # config.pepper = 'adc797843913491e8ff45ccf2e959e07f20d4c20f68b739bbf582b9791053e37c58dbf0190383da2805011863455eae06c985d61147202194435cec929617d0c'
-
# Send a notification to the original email when the user's email is changed.
# config.send_email_changed_notification = false
diff --git a/config/initializers/kaminari_config.rb b/config/initializers/kaminari_config.rb
index 9d3ffc5ce..7e4c00a6b 100644
--- a/config/initializers/kaminari_config.rb
+++ b/config/initializers/kaminari_config.rb
@@ -1,4 +1,3 @@
-# frozen_string_literal: true
Kaminari.configure do |config|
# config.default_per_page = 8
# config.max_per_page = nil
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
index 3647aea43..9a14a1323 100644
--- a/config/initializers/mime_types.rb
+++ b/config/initializers/mime_types.rb
@@ -3,6 +3,6 @@
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
-Rack::Mime::MIME_TYPES[".vtt"]="text/vtt"
-Rack::Mime::MIME_TYPES[".zip"]="application/zip"
-Rack::Mime::MIME_TYPES[".wasm"]="application/wasm"
\ No newline at end of file
+Rack::Mime::MIME_TYPES[".vtt"] = "text/vtt"
+Rack::Mime::MIME_TYPES[".zip"] = "application/zip"
+Rack::Mime::MIME_TYPES[".wasm"] = "application/wasm"
diff --git a/config/initializers/multiple_file_field.rb b/config/initializers/multiple_file_field.rb
index 8309f85c7..b600a4243 100644
--- a/config/initializers/multiple_file_field.rb
+++ b/config/initializers/multiple_file_field.rb
@@ -1,4 +1,4 @@
# prevents upload issue https://github.com/rails/rails/issues/45238
# bad request when uploading multiple files
-Rails.application.config.active_storage.multiple_file_field_include_hidden = false
\ No newline at end of file
+Rails.application.config.active_storage.multiple_file_field_include_hidden = false
diff --git a/config/initializers/preload_medium_sti.rb b/config/initializers/preload_medium_sti.rb
index 0e508b23a..4f2ce80a7 100644
--- a/config/initializers/preload_medium_sti.rb
+++ b/config/initializers/preload_medium_sti.rb
@@ -2,8 +2,8 @@
# zeitwerk integration for sti
autoloader = Rails.autoloaders.main
-sti_leaves = %w(question quiz remark)
+sti_leaves = ["question", "quiz", "remark"]
sti_leaves.each do |leaf|
- autoloader.on_setup { "#{leaf}" }
-end
\ No newline at end of file
+ autoloader.on_setup { leaf.to_s }
+end
diff --git a/config/initializers/prometheus_exporter.rb b/config/initializers/prometheus_exporter.rb
index a1793c0a7..a5d0cfbf6 100644
--- a/config/initializers/prometheus_exporter.rb
+++ b/config/initializers/prometheus_exporter.rb
@@ -1,7 +1,7 @@
# in config/initializers/prometheus.rb
-if Rails.env != "test"
- require 'prometheus_exporter/middleware'
-
- # This reports stats per request like HTTP status and timings
- Rails.application.middleware.unshift PrometheusExporter::Middleware
- end
\ No newline at end of file
+unless Rails.env.test?
+ require "prometheus_exporter/middleware"
+
+ # This reports stats per request like HTTP status and timings
+ Rails.application.middleware.unshift(PrometheusExporter::Middleware)
+end
diff --git a/config/initializers/scrapers.rb b/config/initializers/scrapers.rb
index 48dc46556..80ddea486 100644
--- a/config/initializers/scrapers.rb
+++ b/config/initializers/scrapers.rb
@@ -1 +1 @@
-Dir[File.join(Rails.root, "lib", "scrapers", "*.rb")].each {|l| require l }
+Dir[Rails.root.join("lib/scrapers/*.rb").to_s].each { |l| require l }
diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb
index 6a6b5e6d3..7bb4dc368 100644
--- a/config/initializers/session_store.rb
+++ b/config/initializers/session_store.rb
@@ -1,3 +1,3 @@
-Rails.application.config.session_store :cookie_store,
- key: '_mampf_session',
- same_site: :strict
\ No newline at end of file
+Rails.application.config.session_store(:cookie_store,
+ key: "_mampf_session",
+ same_site: :strict)
diff --git a/config/initializers/shrine.rb b/config/initializers/shrine.rb
index ee3ab920c..64e1d73de 100644
--- a/config/initializers/shrine.rb
+++ b/config/initializers/shrine.rb
@@ -2,24 +2,23 @@
require "shrine/storage/file_system"
require "shrine/storage/memory" if Rails.env.test?
-if Rails.env.development? || Rails.env == 'docker_development'
+if Rails.env.development? || Rails.env.docker_development?
Shrine.storages = {
cache: Shrine::Storage::FileSystem.new("public", prefix: "uploads/cache"),
store: Shrine::Storage::FileSystem.new("public", prefix: "uploads/store"),
submission_cache: Shrine::Storage::FileSystem.new("public",
- prefix: "uploads/submissions/cache"),
+ prefix: "uploads/submissions/cache"),
submission_store: Shrine::Storage::FileSystem.new("public",
- prefix: "uploads/submissions/store"),
+ prefix: "uploads/submissions/store")
}
elsif Rails.env.production?
+ submission_path = ENV["SUBMISSION_PATH"] || "/private/submissions"
Shrine.storages = {
- cache: Shrine::Storage::FileSystem.new("/caches", prefix: "medien_uploads" ,clean:false),
- store: Shrine::Storage::FileSystem.new((ENV['MEDIA_PATH'] || '/private/media'),
+ cache: Shrine::Storage::FileSystem.new("/caches", prefix: "medien_uploads", clean: false),
+ store: Shrine::Storage::FileSystem.new((ENV["MEDIA_PATH"] || "/private/media"),
prefix: "/"),
- submission_cache: Shrine::Storage::FileSystem.new((ENV['SUBMISSION_PATH'] || '/private/submissions'),
- prefix: "cache"),
- submission_store: Shrine::Storage::FileSystem.new((ENV['SUBMISSION_PATH'] || '/private/submissions'),
- prefix: "store"),
+ submission_cache: Shrine::Storage::FileSystem.new(submission_path, prefix: "cache"),
+ submission_store: Shrine::Storage::FileSystem.new(submission_path, prefix: "store")
}
elsif Rails.env.test?
Shrine.storages = {
@@ -30,12 +29,12 @@
}
end
-Shrine.plugin :activerecord
+Shrine.plugin(:activerecord)
# Shrine.plugin :determine_mime_type
-Shrine.plugin :cached_attachment_data # for forms
+Shrine.plugin(:cached_attachment_data) # for forms
# Shrine.plugin :restore_cached_data
-Shrine.plugin :instrumentation
+Shrine.plugin(:instrumentation)
# use mv instead of cp when promoting files from cache to store
# Shrine.plugin :upload_options, cache: { move: !Rails.env.test? },
-# store: { move: !Rails.env.test? }
\ No newline at end of file
+# store: { move: !Rails.env.test? }
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 082cb32a5..4372eb273 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -5,6 +5,6 @@
# by zeitwerk
# see https://github.com/ondrejbartas/sidekiq-cron/issues/249
Rails.application.config.after_initialize do
- Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
+ Sidekiq::Cron::Job.load_from_hash(YAML.load_file(schedule_file))
end
-end
\ No newline at end of file
+end
diff --git a/config/initializers/spec_files.rb b/config/initializers/spec_files.rb
index 2827e5acb..4dc6e31bc 100644
--- a/config/initializers/spec_files.rb
+++ b/config/initializers/spec_files.rb
@@ -1 +1 @@
-SPEC_FILES = "spec/cypress/fixtures/files"
\ No newline at end of file
+SPEC_FILES = "spec/cypress/fixtures/files".freeze
diff --git a/config/initializers/sunspot.rb b/config/initializers/sunspot.rb
index b0853e528..706ec71c6 100644
--- a/config/initializers/sunspot.rb
+++ b/config/initializers/sunspot.rb
@@ -2,17 +2,15 @@
# duplicate entries for Question, Quiz, Remark < Medium
# see https://stackoverflow.com/questions/14832938/rails-sunspot-solr-duplicate-indexing-on-inherited-classes
class StiInstanceAdapter < Sunspot::Adapters::InstanceAdapter
-
def id
@instance.id
end
def index_id
- return Sunspot::Adapters::InstanceAdapter.index_id_for(@instance.class.base_class.name, id)
+ Sunspot::Adapters::InstanceAdapter.index_id_for(@instance.class.base_class.name, id)
end
-
end
Rails.application.reloader.to_prepare do
Sunspot::Adapters::InstanceAdapter.register(StiInstanceAdapter, Medium)
-end
\ No newline at end of file
+end
diff --git a/config/initializers/thredded.rb b/config/initializers/thredded.rb
index e1eb54582..75f4539e3 100644
--- a/config/initializers/thredded.rb
+++ b/config/initializers/thredded.rb
@@ -1,12 +1,10 @@
-# frozen_string_literal: true
-
# Thredded configuration
# ==> User Configuration
# The name of the class your app uses for your users.
# By default the engine will use 'User' but if you have another name
# for your user class - change it here.
-Thredded.user_class = 'User'
+Thredded.user_class = "User"
# User name column, used in @mention syntax and *must* be unique.
# This is the column used to search for users' names if/when someone is @ mentioned.
@@ -21,19 +19,19 @@
# the path or url to your user. This lambda is evaluated in the view context.
# If the lambda returns nil, a span element is returned instead of a link; so
# setting this to always return nil effectively disables all user links.
-Thredded.user_path = ->(user) {
- nil
+Thredded.user_path = lambda { |_user|
}
# This method is used by Thredded controllers and views to fetch the currently signed-in user
Thredded.current_user_method = :"current_#{Thredded.user_class_name.demodulize.underscore}"
# User avatar URL. rb-gravatar gem is used by default:
-Thredded.avatar_url = ->(user) { RailsGravatar.src(user.email, 156, 'mm') }
+Thredded.avatar_url = ->(user) { RailsGravatar.src(user.email, 156, "mm") }
# ==> Permissions Configuration
-# By default, thredded uses a simple permission model, where all the users can post to all message boards,
-# and admins and moderators are determined by a flag on the users table.
+# By default, thredded uses a simple permission model, where all the users can
+# post to all message boards, and admins and moderators are determined by a
+# flag on the users table.
# The name of the moderator flag column on the users table.
Thredded.moderator_column = :admin
@@ -49,7 +47,8 @@
# ==> UI configuration
# How to calculate the position of messageboards in a list:
-# :position (default) set the position manually (new messageboards go to the bottom, by creation timestamp)
+# :position (default) set the position manually
+# (new messageboards go to the bottom, by creation timestamp)
# :last_post_at_desc most recent post first
# :topics_count_desc most topics first
Thredded.messageboards_order = :position
@@ -70,11 +69,12 @@
# Thredded.posts_per_page = 25
# The layout for rendering Thredded views.
-Thredded.layout = 'thredded/application'
+Thredded.layout = "thredded/application"
# ==> Email Configuration
# Email "From:" field will use the following
-# (this is also used as the "To" address for both email notifcations, as all the recipients are on bcc)
+# (this is also used as the "To" address for both email notifcations,
+# as all the recipients are on bcc)
# Thredded.email_from = 'no-reply@example.com'
# Emails going out will prefix the "Subject:" with the following string
@@ -97,7 +97,9 @@
# Thredded.slugifier = ->(input) { input.parameterize }
# If your forum is in a language other than English, you might want to use the babosa gem instead
-# Thredded.slugifier = ->(input) { Babosa::Identifier.new(input).normalize.transliterate(:russian).to_s }
+# Thredded.slugifier = lambda { |input|
+# Babosa::Identifier.new(input).normalize.transliterate(:russian).to_s
+# }
# By default, thredded uses integers for record ID route constraints.
# For integer based IDs (default):
@@ -123,7 +125,8 @@
# Thredded.autocomplete_min_length = 2 lower to 1 if have 1-letter names -- increase if you want
# ==> Error Handling
-# By default Thredded just renders a flash alert on errors such as Topic not found, or Login required.
+# By default Thredded just renders a flash alert on errors such as Topic
+# not found, or Login required.
# Below is an example of overriding the default behavior on LoginRequired:
#
# Rails.application.config.to_prepare do
@@ -149,30 +152,35 @@
# $ grep view_hooks -R --include '*.html.erb' "$(bundle show thredded)"
#
Rails.application.config.to_prepare do
- Thredded.view_hooks.post_form.content_text_area.config.before do |form:, **args|
- # This is called in the Thredded view context, so all Thredded helpers and URLs are accessible here directly.
- render 'thredded/modifications/explain_tex', form: form
+ Thredded.view_hooks.post_form.content_text_area.config.before do |form:, **_args|
+ # This is called in the Thredded view context, so all Thredded helpers
+ # and URLs are accessible here directly.
+ render "thredded/modifications/explain_tex", form: form
end
end
# ==> Topic following
#
-# By default, a user will be subscribed to a topic they've created. Uncomment this to not subscribe them:
+# By default, a user will be subscribed to a topic they've created.
+# Uncomment this to not subscribe them:
#
# Thredded.auto_follow_when_creating_topic = false
#
-# By default, a user will be subscribed to (follow) a topic they post in. Uncomment this to not subscribe them:
+# By default, a user will be subscribed to (follow) a topic they post in.
+# Uncomment this to not subscribe them:
#
# Thredded.auto_follow_when_posting_in_topic = false
#
# By default, a user will be subscribed to the topic they get @-mentioned in.
# Individual users can disable this in the Notification Settings.
-# To change the default for all users, simply change the default value of the `follow_topics_on_mention` column
-# of the `thredded_user_preferences` and `thredded_user_messageboard_preferences` tables.
+# To change the default for all users, simply change the default value of the
+# `follow_topics_on_mention` column of the `thredded_user_preferences`
+# and `thredded_user_messageboard_preferences` tables.
# ==> Notifiers
#
-# Change how users can choose to be notified, by adding notifiers here, or removing the initializer altogether
+# Change how users can choose to be notified, by adding notifiers here,
+# or removing the initializer altogether
#
# default:
# Thredded.notifiers = [Thredded::EmailNotifier.new]
@@ -181,4 +189,5 @@
Thredded.notifiers = []
#
# add in (must install separate gem (under development) as well):
-# Thredded.notifiers = [Thredded::EmailNotifier.new, Thredded::PushoverNotifier.new(ENV['PUSHOVER_APP_ID'])]
+# Thredded.notifiers = [Thredded::EmailNotifier.new,
+# Thredded::PushoverNotifier.new(ENV.fetch("PUSHOVER_APP_ID", nil))]
diff --git a/config/locales/de.yml b/config/locales/de.yml
index 017f6fbdb..214eb9534 100644
--- a/config/locales/de.yml
+++ b/config/locales/de.yml
@@ -3051,7 +3051,7 @@ de:
Hash:%{hash}
data_request_mail_body: >
%{mail} mit User-Id: %{id} hat ihre Daten angefordert.
- data_provide_mail_subject: Anfrage nach Daten
+ data_provide_mail_subject: Datenanfrage
data_provide_mail_body: >
Hallo, %{name}!
diff --git a/config/puma.rb b/config/puma.rb
index bcf34b31a..06209aa8b 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -4,22 +4,22 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
-max_threads_count = ENV.fetch('RAILS_MAX_THREADS') { 5 }
-min_threads_count = ENV.fetch('RAILS_MIN_THREADS') { max_threads_count }
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
-worker_timeout 3600 if ENV.fetch('RAILS_ENV', 'development') == 'development'
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
-port ENV.fetch('PORT') { 3000 }
+port ENV.fetch("PORT", 3000)
# Specifies the `environment` that Puma will run in.
-environment ENV.fetch('RAILS_ENV') { 'development' }
+environment ENV.fetch("RAILS_ENV") { "development" }
# Specifies the `pidfile` that Puma will use.
-pidfile ENV.fetch('PIDFILE') { 'tmp/pids/server.pid' }
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
index 46bc8c68d..719a40ff8 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,60 +1,59 @@
Rails.application.routes.draw do
-
# mount sidekiq engine
- require 'sidekiq/web'
- require 'sidekiq/cron/web'
+ require "sidekiq/web"
+ require "sidekiq/cron/web"
- authenticate :user, lambda { |u| u.admin? } do
- mount Sidekiq::Web => '/sidekiq'
+ authenticate :user, ->(u) { u.admin? } do
+ mount Sidekiq::Web => "/sidekiq"
end
# mount commontator engine
- mount Commontator::Engine => '/commontator'
+ mount Commontator::Engine => "/commontator"
# search routes
- get 'search/index'
+ get "search/index"
# administration routes
- get '/administration',
- to: 'administration#index',
- as: 'administration'
+ get "/administration",
+ to: "administration#index",
+ as: "administration"
- get '/administration/exit',
- to: 'administration#exit',
- as: 'exit_administration'
+ get "/administration/exit",
+ to: "administration#exit",
+ as: "exit_administration"
- get '/administration/profile',
- to: 'administration#profile',
- as: 'elevated_profile'
+ get "/administration/profile",
+ to: "administration#profile",
+ as: "elevated_profile"
- get 'administration/search',
- to: 'administration#search',
- as: 'administration_search'
+ get "administration/search",
+ to: "administration#search",
+ as: "administration_search"
- get '/administration/classification',
- to: 'administration#classification',
- as: 'classification'
+ get "/administration/classification",
+ to: "administration#classification",
+ as: "classification"
# announcements routes
- post 'announcements/:id/propagate',
- to: 'announcements#propagate',
- as: 'propagate_announcement'
+ post "announcements/:id/propagate",
+ to: "announcements#propagate",
+ as: "propagate_announcement"
- post 'announcements/:id/expel',
- to: 'announcements#expel',
- as: 'expel_announcement'
+ post "announcements/:id/expel",
+ to: "announcements#expel",
+ as: "expel_announcement"
resources :announcements, only: [:index, :new, :create]
# answers routes
- get 'answers/update_answer_box',
- as: 'update_answer_box'
+ get "answers/update_answer_box",
+ as: "update_answer_box"
resources :answers, except: [:index, :show, :edit]
@@ -64,56 +63,56 @@
# assignments routes
- get 'assignments/:id/cancel_edit',
- to: 'assignments#cancel_edit',
- as: 'cancel_edit_assignment'
+ get "assignments/:id/cancel_edit",
+ to: "assignments#cancel_edit",
+ as: "cancel_edit_assignment"
- get 'assignments/cancel_new',
- to: 'assignments#cancel_new',
- as: 'cancel_new_assignment'
+ get "assignments/cancel_new",
+ to: "assignments#cancel_new",
+ as: "cancel_new_assignment"
resources :assignments, only: [:new, :edit, :create, :update, :destroy]
# chapters routes
- get 'chapters/:id/list_sections',
- to: 'chapters#list_sections',
- as: 'list_sections'
+ get "chapters/:id/list_sections",
+ to: "chapters#list_sections",
+ as: "list_sections"
resources :chapters, except: [:index, :show]
# clickers routes
- get 'clickers/:id/open',
- to: 'clickers#open',
- as: 'open_clicker'
+ get "clickers/:id/open",
+ to: "clickers#open",
+ as: "open_clicker"
- get 'clickers/:id/close',
- to: 'clickers#close',
- as: 'close_clicker'
+ get "clickers/:id/close",
+ to: "clickers#close",
+ as: "close_clicker"
- post 'clickers/:id/set_alternatives',
- to: 'clickers#set_alternatives',
- as: 'set_clicker_alternatives'
+ post "clickers/:id/set_alternatives",
+ to: "clickers#set_alternatives",
+ as: "set_clicker_alternatives"
- post 'clickers/:id/associate_question',
- to: 'clickers#associate_question',
- as: 'associate_question'
+ post "clickers/:id/associate_question",
+ to: "clickers#associate_question",
+ as: "associate_question"
- get 'clickers/:id/get_votes_count',
- to: 'clickers#get_votes_count',
- as: 'get_votes_count'
+ get "clickers/:id/votes_count",
+ to: "clickers#votes_count",
+ as: "votes_count"
- delete 'clickers/:id/remove_question',
- to: 'clickers#remove_question',
- as: 'remove_question'
+ delete "clickers/:id/remove_question",
+ to: "clickers#remove_question",
+ as: "remove_question"
- get 'clickers/:id/render_clickerizable_actions',
- to: 'clickers#render_clickerizable_actions',
- as: 'render_clickerizable_actions'
+ get "clickers/:id/render_clickerizable_actions",
+ to: "clickers#render_clickerizable_actions",
+ as: "render_clickerizable_actions"
- get 'c/:id',
- to: 'clickers#show'
+ get "c/:id",
+ to: "clickers#show"
resources :clickers, except: [:index, :update]
@@ -123,17 +122,17 @@
# courses routes
- post 'courses/:id/take_random_quiz',
- to: 'courses#take_random_quiz',
- as: 'random_quiz'
+ post "courses/:id/take_random_quiz",
+ to: "courses#take_random_quiz",
+ as: "random_quiz"
- get 'courses/:id/render_question_counter',
- to: 'courses#render_question_counter',
- as: 'render_question_counter'
+ get "courses/:id/render_question_counter",
+ to: "courses#render_question_counter",
+ as: "render_question_counter"
- get 'courses/search',
- to: 'courses#search',
- as: 'search_courses'
+ get "courses/search",
+ to: "courses#search",
+ as: "search_courses"
resources :courses, except: [:index, :show, :new]
@@ -143,127 +142,127 @@
# interactions routes
- get 'interactions/export_interactions',
- as: 'export_interactions'
+ get "interactions/export_interactions",
+ as: "export_interactions"
- get 'interactions/export_probes',
- as: 'export_probes'
+ get "interactions/export_probes",
+ as: "export_probes"
resources :interactions, only: [:index]
# items routes
- get 'items/:id/display',
- to: 'items#display',
- as: 'display_item'
+ get "items/:id/display",
+ to: "items#display",
+ as: "display_item"
resources :items, only: [:update, :create, :edit, :destroy]
# lectures routes
- get 'lectures/:id/food',
- to: 'media#index',
- as: 'lecture_food'
+ get "lectures/:id/food",
+ to: "media#index",
+ as: "lecture_food"
- get 'lectures/:id/update_teacher',
- to: 'lectures#update_teacher',
- as: 'update_teacher'
+ get "lectures/:id/update_teacher",
+ to: "lectures#update_teacher",
+ as: "update_teacher"
- get 'lectures/:id/update_editors',
- to: 'lectures#update_editors',
- as: 'update_editors'
+ get "lectures/:id/update_editors",
+ to: "lectures#update_editors",
+ as: "update_editors"
- get 'lectures/:id/add_forum',
- to: 'lectures#add_forum',
- as: 'add_forum'
+ get "lectures/:id/add_forum",
+ to: "lectures#add_forum",
+ as: "add_forum"
- get 'lectures/:id/lock_forum',
- to: 'lectures#lock_forum',
- as: 'lock_forum'
+ get "lectures/:id/lock_forum",
+ to: "lectures#lock_forum",
+ as: "lock_forum"
- get 'lectures/:id/unlock_forum',
- to: 'lectures#unlock_forum',
- as: 'unlock_forum'
+ get "lectures/:id/unlock_forum",
+ to: "lectures#unlock_forum",
+ as: "unlock_forum"
- get 'lectures/:id/destroy_forum',
- to: 'lectures#destroy_forum',
- as: 'destroy_forum'
+ get "lectures/:id/destroy_forum",
+ to: "lectures#destroy_forum",
+ as: "destroy_forum"
- get 'lectures/:id/show_announcements',
- to: 'lectures#show_announcements',
- as: 'show_announcements'
+ get "lectures/:id/show_announcements",
+ to: "lectures#show_announcements",
+ as: "show_announcements"
- get 'lectures/:id/organizational',
- to: 'lectures#organizational',
- as: 'organizational'
+ get "lectures/:id/organizational",
+ to: "lectures#organizational",
+ as: "organizational"
- get 'lectures/:id/show_random_quizzes',
- to: 'lectures#show_random_quizzes',
- as: 'show_random_quizzes'
+ get "lectures/:id/show_random_quizzes",
+ to: "lectures#show_random_quizzes",
+ as: "show_random_quizzes"
- get 'lectures/:id/show_subscribers',
- to: 'lectures#show_subscribers',
- as: 'show_subscribers'
+ get "lectures/:id/show_subscribers",
+ to: "lectures#show_subscribers",
+ as: "show_subscribers"
- get 'lectures/:id/show_structures',
- to: 'lectures#show_structures',
- as: 'show_structures'
+ get "lectures/:id/show_structures",
+ to: "lectures#show_structures",
+ as: "show_structures"
- get 'lectures/:id/edit_structures',
- to: 'lectures#edit_structures',
- as: 'edit_structures'
+ get "lectures/:id/edit_structures",
+ to: "lectures#edit_structures",
+ as: "edit_structures"
- get 'lectures/:id/search_examples',
- to: 'lectures#search_examples',
- as: 'search_examples'
+ get "lectures/:id/search_examples",
+ to: "lectures#search_examples",
+ as: "search_examples"
- get 'lectures/search',
- to: 'lectures#search',
- as: 'lecture_search'
+ get "lectures/search",
+ to: "lectures#search",
+ as: "lecture_search"
- get 'lectures/:id/display_course',
- to: 'lectures#display_course',
- as: 'display_course'
+ get "lectures/:id/display_course",
+ to: "lectures#display_course",
+ as: "display_course"
- post 'lectures/:id/publish',
- to: 'lectures#publish',
- as: 'publish_lecture'
+ post "lectures/:id/publish",
+ to: "lectures#publish",
+ as: "publish_lecture"
- post 'lectures/:id/import_media',
- to: 'lectures#import_media',
- as: 'lecture_import_media'
+ post "lectures/:id/import_media",
+ to: "lectures#import_media",
+ as: "lecture_import_media"
- delete 'lectures/:id/remove_imported_medium',
- to: 'lectures#remove_imported_medium',
- as: 'lecture_remove_imported_medium'
+ delete "lectures/:id/remove_imported_medium",
+ to: "lectures#remove_imported_medium",
+ as: "lecture_remove_imported_medium"
- get 'lectures/:id/close_comments',
- to: 'lectures#close_comments',
- as: 'lecture_close_comments'
+ get "lectures/:id/close_comments",
+ to: "lectures#close_comments",
+ as: "lecture_close_comments"
- get 'lectures/:id/open_comments',
- to: 'lectures#open_comments',
- as: 'lecture_open_comments'
+ get "lectures/:id/open_comments",
+ to: "lectures#open_comments",
+ as: "lecture_open_comments"
- get 'lectures/:id/submissions',
- to: 'submissions#index',
- as: 'lecture_submissions'
+ get "lectures/:id/submissions",
+ to: "submissions#index",
+ as: "lecture_submissions"
- get 'lectures/:id/tutorials',
- to: 'tutorials#index',
- as: 'lecture_tutorials'
+ get "lectures/:id/tutorials",
+ to: "tutorials#index",
+ as: "lecture_tutorials"
- get 'lectures/:id/tutorial_overview',
- to: 'tutorials#overview',
- as: 'lecture_tutorial_overview'
+ get "lectures/:id/tutorial_overview",
+ to: "tutorials#overview",
+ as: "lecture_tutorial_overview"
- get 'lectures/:id/subscribe',
- to: 'lectures#subscribe_page',
- as: 'subscribe_lecture_page'
+ get "lectures/:id/subscribe",
+ to: "lectures#subscribe_page",
+ as: "subscribe_lecture_page"
- post 'lectures/:id/import_toc',
- to: 'lectures#import_toc',
- as: 'import_lecture_toc'
+ post "lectures/:id/import_toc",
+ to: "lectures#import_toc",
+ as: "import_lecture_toc"
resources :lectures, except: [:index]
@@ -273,177 +272,177 @@
# media routes
- get 'media/search',
- to: 'media#search',
- as: 'media_search'
+ get "media/search",
+ to: "media#search",
+ as: "media_search"
- get 'media/:id/inspect',
- to: 'media#inspect',
- as: 'inspect_medium'
+ get "media/:id/inspect",
+ to: "media#inspect",
+ as: "inspect_medium"
- get 'media/:id/enrich',
- to: 'media#enrich',
- as: 'enrich_medium'
+ get "media/:id/enrich",
+ to: "media#enrich",
+ as: "enrich_medium"
- get 'media/:id/play',
- to: 'media#play',
- as: 'play_medium'
+ get "media/:id/play",
+ to: "media#play",
+ as: "play_medium"
- get 'media/:id/display',
- to: 'media#display',
- as: 'display_medium'
+ get "media/:id/display",
+ to: "media#display",
+ as: "display_medium"
- get 'media/:id/geogebra',
- to: 'media#geogebra',
- as: 'geogebra_medium'
+ get "media/:id/geogebra",
+ to: "media#geogebra",
+ as: "geogebra_medium"
- get 'media/:id/add_item',
- to: 'media#add_item',
- as: 'add_item'
+ get "media/:id/add_item",
+ to: "media#add_item",
+ as: "add_item"
- get 'media/:id/add_reference',
- to: 'media#add_reference',
- as: 'add_reference'
+ get "media/:id/add_reference",
+ to: "media#add_reference",
+ as: "add_reference"
- get 'media/:id/import_script_items',
- to: 'media#import_script_items',
- as: 'import_script_items'
+ get "media/:id/import_script_items",
+ to: "media#import_script_items",
+ as: "import_script_items"
- patch 'media/:id/remove_screenshot',
- to: 'media#remove_screenshot',
- as: 'remove_screenshot'
+ patch "media/:id/remove_screenshot",
+ to: "media#remove_screenshot",
+ as: "remove_screenshot"
- post 'media/:id/add_screenshot',
- to: 'media#add_screenshot',
- as: 'add_screenshot'
+ post "media/:id/add_screenshot",
+ to: "media#add_screenshot",
+ as: "add_screenshot"
- post 'media/:id/publish',
- to: 'media#publish',
- as: 'publish_medium'
+ post "media/:id/publish",
+ to: "media#publish",
+ as: "publish_medium"
- post 'media/:id/import_manuscript',
- to: 'media#import_manuscript',
- as: 'import_manuscript'
+ post "media/:id/import_manuscript",
+ to: "media#import_manuscript",
+ as: "import_manuscript"
- get 'media/fill_teachable_select',
- to: 'media#fill_teachable_select',
- as: 'fill_teachable_select'
+ get "media/fill_teachable_select",
+ to: "media#fill_teachable_select",
+ as: "fill_teachable_select"
- get 'media/fill_media_select',
- to: 'media#fill_media_select',
- as: 'fill_media_select'
+ get "media/fill_media_select",
+ to: "media#fill_media_select",
+ as: "fill_media_select"
- post 'media/update_tags',
- to: 'media#update_tags',
- as: 'update_tags'
+ post "media/update_tags",
+ to: "media#update_tags",
+ as: "update_tags"
- post 'media/:id/register_download',
- to: 'media#register_download',
- as: 'register_download'
+ post "media/:id/register_download",
+ to: "media#register_download",
+ as: "register_download"
- get 'media/:id/get_statistics',
- to: 'media#get_statistics',
- as: 'get_statistics'
+ get "media/:id/statistics",
+ to: "media#statistics",
+ as: "statistics"
- get 'media/:id/show_comments',
- to: 'media#show_comments',
- as: 'show_media_comments'
+ get "media/:id/show_comments",
+ to: "media#show_comments",
+ as: "show_media_comments"
- delete 'media/:id/cancel_publication',
- to: 'media#cancel_publication',
- as: 'cancel_publication'
+ delete "media/:id/cancel_publication",
+ to: "media#cancel_publication",
+ as: "cancel_publication"
- get 'media/:id/fill_medium_preview',
- to: 'media#fill_medium_preview',
- as: 'fill_medium_preview'
+ get "media/:id/fill_medium_preview",
+ to: "media#fill_medium_preview",
+ as: "fill_medium_preview"
- get 'media/:id/render_medium_actions',
- to: 'media#render_medium_actions',
- as: 'render_medium_actions'
+ get "media/:id/render_medium_actions",
+ to: "media#render_medium_actions",
+ as: "render_medium_actions"
- get 'media/:id/render_import_media',
- to: 'media#render_import_media',
- as: 'render_import_media'
+ get "media/:id/render_import_media",
+ to: "media#render_import_media",
+ as: "render_import_media"
- get 'media/:id/render_import_vertex',
- to: 'media#render_import_vertex',
- as: 'render_import_vertex'
+ get "media/:id/render_import_vertex",
+ to: "media#render_import_vertex",
+ as: "render_import_vertex"
- get 'media/:id/render_medium_tags',
- to: 'media#render_medium_tags',
- as: 'render_medium_tags'
+ get "media/:id/render_medium_tags",
+ to: "media#render_medium_tags",
+ as: "render_medium_tags"
- get 'media/cancel_import_media',
- as: 'cancel_import_media'
+ get "media/cancel_import_media",
+ as: "cancel_import_media"
- get 'media/cancel_import_vertex',
- as: 'cancel_import_vertex'
+ get "media/cancel_import_vertex",
+ as: "cancel_import_vertex"
- get 'media/:id/fill_quizzable_area',
- to: 'media#fill_quizzable_area',
- as: 'fill_quizzable_area'
+ get "media/:id/fill_quizzable_area",
+ to: "media#fill_quizzable_area",
+ as: "fill_quizzable_area"
- get 'media/:id/fill_quizzable_preview',
- to: 'media#fill_quizzable_preview',
- as: 'fill_quizzable_preview'
+ get "media/:id/fill_quizzable_preview",
+ to: "media#fill_quizzable_preview",
+ as: "fill_quizzable_preview"
- get 'media/:id/fill_reassign_modal',
- to: 'media#fill_reassign_modal',
- as: 'fill_reassign_modal'
+ get "media/:id/fill_reassign_modal",
+ to: "media#fill_reassign_modal",
+ as: "fill_reassign_modal"
resources :media
# notifications controller
- post 'notifications/destroy_all',
- to: 'notifications#destroy_all',
- as: 'destroy_all_notifications'
+ post "notifications/destroy_all",
+ to: "notifications#destroy_all",
+ as: "destroy_all_notifications"
- post 'notifications/destroy_lecture_notifications',
- to: 'notifications#destroy_lecture_notifications',
- as: 'destroy_lecture_notifications'
+ post "notifications/destroy_lecture_notifications",
+ to: "notifications#destroy_lecture_notifications",
+ as: "destroy_lecture_notifications"
- post 'notifications/destroy_news_notifications',
- to: 'notifications#destroy_news_notifications',
- as: 'destroy_news_notifications'
+ post "notifications/destroy_news_notifications",
+ to: "notifications#destroy_news_notifications",
+ as: "destroy_news_notifications"
resources :notifications, only: [:index, :destroy]
# profile routes
- get 'profile/edit',
- as: 'edit_profile'
+ get "profile/edit",
+ as: "edit_profile"
- post 'profile/update'
+ post "profile/update"
- get 'profile/check_for_consent',
- as: 'consent_profile'
+ get "profile/check_for_consent",
+ as: "consent_profile"
- patch 'profile/add_consent',
- as: 'add_consent'
+ patch "profile/add_consent",
+ as: "add_consent"
- put 'profile/add_consent'
+ put "profile/add_consent"
- post 'profile/toggle_thread_subscription',
- as: 'toggle_thread_subscription'
+ post "profile/toggle_thread_subscription",
+ as: "toggle_thread_subscription"
- patch 'profile/subscribe_lecture',
- as: 'subscribe_lecture'
+ patch "profile/subscribe_lecture",
+ as: "subscribe_lecture"
- patch 'profile/unsubscribe_lecture',
- as: 'unsubscribe_lecture'
+ patch "profile/unsubscribe_lecture",
+ as: "unsubscribe_lecture"
- get 'profile/show_accordion',
- as: 'show_accordion'
+ get "profile/show_accordion",
+ as: "show_accordion"
- patch 'profile/star_lecture',
- as: 'star_lecture'
+ patch "profile/star_lecture",
+ as: "star_lecture"
- patch 'profile/unstar_lecture',
- as: 'unstar_lecture'
+ patch "profile/unstar_lecture",
+ as: "unstar_lecture"
- get 'profile/request_data',
- as: 'request_data'
+ get "profile/request_data",
+ as: "request_data"
# programs routes
@@ -451,78 +450,78 @@
# questions routes
- patch 'questions/:id/reassign',
- to: 'questions#reassign',
- as: 'reassign_question'
+ patch "questions/:id/reassign",
+ to: "questions#reassign",
+ as: "reassign_question"
- patch 'question/:id/set_solution_type',
- to: 'questions#set_solution_type',
- as: 'set_solution_type'
+ patch "question/:id/set_solution_type",
+ to: "questions#set_solution_type",
+ as: "set_solution_type"
- get 'questions/:id/cancel_question_basics',
- to: 'questions#cancel_question_basics',
- as: 'cancel_question_basics'
+ get "questions/:id/cancel_question_basics",
+ to: "questions#cancel_question_basics",
+ as: "cancel_question_basics"
- get 'questions/:id/cancel_solution_edit',
- to: 'questions#cancel_solution_edit',
- as: 'cancel_solution_edit'
+ get "questions/:id/cancel_solution_edit",
+ to: "questions#cancel_solution_edit",
+ as: "cancel_solution_edit"
- get 'questions/:id/render_question_parameters',
- to: 'questions#render_question_parameters',
- as: 'render_question_parameters'
+ get "questions/:id/render_question_parameters",
+ to: "questions#render_question_parameters",
+ as: "render_question_parameters"
resources :questions, only: [:edit, :update]
# quizzes routes
- post 'quiz_certificates/:id/claim',
- to: 'quiz_certificates#claim',
- as: 'claim_quiz_certificate'
+ post "quiz_certificates/:id/claim",
+ to: "quiz_certificates#claim",
+ as: "claim_quiz_certificate"
- post 'quiz_certificates/validate',
- to: 'quiz_certificates#validate',
- as: 'validate_certificate'
+ post "quiz_certificates/validate",
+ to: "quiz_certificates#validate",
+ as: "validate_certificate"
- get 'quizzes/:id/take',
- to: 'quizzes#take',
- as: 'take_quiz'
+ get "quizzes/:id/take",
+ to: "quizzes#take",
+ as: "take_quiz"
- patch 'quizzes/:id/take',
- to: 'quizzes#proceed'
+ patch "quizzes/:id/take",
+ to: "quizzes#proceed"
- put 'quizzes/:id/take',
- to: 'quizzes#proceed'
+ put "quizzes/:id/take",
+ to: "quizzes#proceed"
- patch 'quizzes/:id/linearize',
- to: 'quizzes#linearize',
- as: 'linearize_quiz'
- post 'quizzes/:id/set_root',
- to: 'quizzes#set_root',
- as: 'set_quiz_root'
+ patch "quizzes/:id/linearize",
+ to: "quizzes#linearize",
+ as: "linearize_quiz"
+ post "quizzes/:id/set_root",
+ to: "quizzes#set_root",
+ as: "set_quiz_root"
- post 'quizzes/:id/set_level',
- to: 'quizzes#set_level',
- as: 'set_quiz_level'
+ post "quizzes/:id/set_level",
+ to: "quizzes#set_level",
+ as: "set_quiz_level"
- post 'quizzes/:id/update_default_target',
- to: 'quizzes#update_default_target',
- as: 'update_default_target'
+ post "quizzes/:id/update_default_target",
+ to: "quizzes#update_default_target",
+ as: "update_default_target"
- delete 'quizzes/:id/delete_edge',
- to: 'quizzes#delete_edge',
- as: 'delete_edge'
+ delete "quizzes/:id/delete_edge",
+ to: "quizzes#delete_edge",
+ as: "delete_edge"
- get 'quizzes/update_branching',
- to: 'quizzes#update_branching',
- as: 'update_branching'
+ get "quizzes/update_branching",
+ to: "quizzes#update_branching",
+ as: "update_branching"
- get 'quizzes/:id/edit_vertex_targets',
- to: 'quizzes#edit_vertex_targets',
- as: 'edit_vertex_targets'
+ get "quizzes/:id/edit_vertex_targets",
+ to: "quizzes#edit_vertex_targets",
+ as: "edit_vertex_targets"
- get 'quizzes/:id/render_vertex_quizzable',
- to: 'quizzes#render_vertex_quizzable',
- as: 'render_vertex_quizzable'
+ get "quizzes/:id/render_vertex_quizzable",
+ to: "quizzes#render_vertex_quizzable",
+ as: "render_vertex_quizzable"
resources :quizzes, except: [:show, :index, :create] do
resources :vertices, except: [:index, :show, :edit]
@@ -530,31 +529,31 @@
# readers routes
- patch 'readers/update',
- to: 'readers#update',
- as: 'update_reader'
+ patch "readers/update",
+ to: "readers#update",
+ as: "update_reader"
- patch 'readers/update_all',
- to: 'readers#update_all',
- as: 'update_all_readers'
+ patch "readers/update_all",
+ to: "readers#update_all",
+ as: "update_all_readers"
# referrals routes
- get 'referrals/list_items',
- to: 'referrals#list_items',
- as: 'list_items'
+ get "referrals/list_items",
+ to: "referrals#list_items",
+ as: "list_items"
resources :referrals, only: [:update, :create, :edit, :destroy]
# remarks routes
- patch 'remarks/:id/reassign',
- to: 'remarks#reassign',
- as: 'reassign_remark'
+ patch "remarks/:id/reassign",
+ to: "remarks#reassign",
+ as: "reassign_remark"
- get 'remarks/:id/cancel_remark_basics',
- to: 'remarks#cancel_remark_basics',
- as: 'cancel_remark_basics'
+ get "remarks/:id/cancel_remark_basics",
+ to: "remarks#cancel_remark_basics",
+ as: "cancel_remark_basics"
resources :remarks, only: [:edit, :update]
@@ -564,240 +563,240 @@
# submissions routes
- post 'submissions/join',
- to: 'submissions#join',
- as: 'join_submission'
+ post "submissions/join",
+ to: "submissions#join",
+ as: "join_submission"
- get 'submissions/enter_code',
- to: 'submissions#enter_code',
- as: 'enter_submission_code'
+ get "submissions/enter_code",
+ to: "submissions#enter_code",
+ as: "enter_submission_code"
- get 'submissions/redeem_code',
- to: 'submissions#redeem_code',
- as: 'redeem_submission_code'
+ get "submissions/redeem_code",
+ to: "submissions#redeem_code",
+ as: "redeem_submission_code"
- delete 'submissions/:id/leave',
- to: 'submissions#leave',
- as: 'leave_submission'
+ delete "submissions/:id/leave",
+ to: "submissions#leave",
+ as: "leave_submission"
- get 'submissions/:id/cancel_edit',
- to: 'submissions#cancel_edit',
- as: 'cancel_edit_submission'
+ get "submissions/:id/cancel_edit",
+ to: "submissions#cancel_edit",
+ as: "cancel_edit_submission"
- get 'submissions/cancel_new',
- to: 'submissions#cancel_new',
- as: 'cancel_new_submission'
+ get "submissions/cancel_new",
+ to: "submissions#cancel_new",
+ as: "cancel_new_submission"
- get 'submissions/:id/show_manuscript',
- to: 'submissions#show_manuscript',
- as: 'show_submission_manuscript'
+ get "submissions/:id/show_manuscript",
+ to: "submissions#show_manuscript",
+ as: "show_submission_manuscript"
- patch 'submissions/:id/refresh_token',
- to: 'submissions#refresh_token',
- as: 'refresh_submission_token'
+ patch "submissions/:id/refresh_token",
+ to: "submissions#refresh_token",
+ as: "refresh_submission_token"
- get 'submissions/:id/enter_invitees',
- to: 'submissions#enter_invitees',
- as: 'enter_submission_invitees'
+ get "submissions/:id/enter_invitees",
+ to: "submissions#enter_invitees",
+ as: "enter_submission_invitees"
- post 'submissions/:id/invite',
- to: 'submissions#invite',
- as: 'invite_to_submission'
+ post "submissions/:id/invite",
+ to: "submissions#invite",
+ as: "invite_to_submission"
- post 'submissions/:id/add_correction',
- to: 'submissions#add_correction',
- as: 'add_correction'
+ post "submissions/:id/add_correction",
+ to: "submissions#add_correction",
+ as: "add_correction"
- get 'submissions/:id/show_correction',
- to: 'submissions#show_correction',
- as: 'show_correction'
+ get "submissions/:id/show_correction",
+ to: "submissions#show_correction",
+ as: "show_correction"
- get 'submissions/:id/select_tutorial',
- to: 'submissions#select_tutorial',
- as: 'select_tutorial'
+ get "submissions/:id/select_tutorial",
+ to: "submissions#select_tutorial",
+ as: "select_tutorial"
- patch 'submissions/:id/move',
- to: 'submissions#move',
- as: 'move_submission'
+ patch "submissions/:id/move",
+ to: "submissions#move",
+ as: "move_submission"
- get 'submissions/:id/cancel_action',
- to: 'submissions#cancel_action',
- as: 'cancel_submission_action'
+ get "submissions/:id/cancel_action",
+ to: "submissions#cancel_action",
+ as: "cancel_submission_action"
- delete 'submissions/:id/delete_correction',
- to: 'submissions#delete_correction',
- as: 'delete_correction'
+ delete "submissions/:id/delete_correction",
+ to: "submissions#delete_correction",
+ as: "delete_correction"
- patch 'submissions/:id/accept',
- to: 'submissions#accept',
- as: 'accept_submission'
+ patch "submissions/:id/accept",
+ to: "submissions#accept",
+ as: "accept_submission"
- patch 'submissions/:id/reject',
- to: 'submissions#reject',
- as: 'reject_submission'
+ patch "submissions/:id/reject",
+ to: "submissions#reject",
+ as: "reject_submission"
- get 'submissions/:id/edit_correction',
- to: 'submissions#edit_correction',
- as: 'edit_correction'
+ get "submissions/:id/edit_correction",
+ to: "submissions#edit_correction",
+ as: "edit_correction"
- get 'submissions/:id/cancel_edit_correction',
- to: 'submissions#cancel_edit_correction',
- as: 'cancel_edit_correction'
+ get "submissions/:id/cancel_edit_correction",
+ to: "submissions#cancel_edit_correction",
+ as: "cancel_edit_correction"
resources :submissions, except: [:index, :show]
# tags routes
- get 'tags/modal',
- to: 'tags#modal',
- as: 'tag_modal'
+ get "tags/modal",
+ to: "tags#modal",
+ as: "tag_modal"
- get 'tags/:id/display_cyto',
- to: 'tags#display_cyto',
- as: 'display_cyto_tag'
+ get "tags/:id/display_cyto",
+ to: "tags#display_cyto",
+ as: "display_cyto_tag"
- patch 'tags/:id/identify',
- to: 'tags#identify',
- as: 'identify_tags'
+ patch "tags/:id/identify",
+ to: "tags#identify",
+ as: "identify_tags"
- put 'tags/:id/identify',
- to: 'tags#identify'
+ put "tags/:id/identify",
+ to: "tags#identify"
- get 'tags/fill_tag_select',
- to: 'tags#fill_tag_select',
- as: 'fill_tag_select'
+ get "tags/fill_tag_select",
+ to: "tags#fill_tag_select",
+ as: "fill_tag_select"
- get 'events/fill_course_tags',
- to: 'tags#fill_course_tags',
- as: 'fill_course_tags'
+ get "events/fill_course_tags",
+ to: "tags#fill_course_tags",
+ as: "fill_course_tags"
- get 'tags/search',
- to: 'tags#search',
- as: 'tags_search'
+ get "tags/search",
+ to: "tags#search",
+ as: "tags_search"
- get 'tags/:id/take_random_quiz',
- to: 'tags#take_random_quiz',
- as: 'tag_random_quiz'
+ get "tags/:id/take_random_quiz",
+ to: "tags#take_random_quiz",
+ as: "tag_random_quiz"
- post 'tags/postprocess',
- to: 'tags#postprocess',
- as: 'postprocess_tags'
+ post "tags/postprocess",
+ to: "tags#postprocess",
+ as: "postprocess_tags"
- get 'tags/render_tag_title',
- as: 'render_tag_title'
+ get "tags/render_tag_title",
+ as: "render_tag_title"
resources :tags, except: :index
# talks routes
- get 'talks/:id/assemble',
- to: 'talks#assemble',
- as: 'assemble_talk'
+ get "talks/:id/assemble",
+ to: "talks#assemble",
+ as: "assemble_talk"
- post 'talks/:id/modify',
- to: 'talks#modify',
- as: 'modify_talk'
+ post "talks/:id/modify",
+ to: "talks#modify",
+ as: "modify_talk"
resources :talks, except: [:index]
# tutorials routes
- get 'tutorials/:id/cancel_edit',
- to: 'tutorials#cancel_edit',
- as: 'cancel_edit_tutorial'
+ get "tutorials/:id/cancel_edit",
+ to: "tutorials#cancel_edit",
+ as: "cancel_edit_tutorial"
- get 'tutorials/cancel_new',
- to: 'tutorials#cancel_new',
- as: 'cancel_new_tutorial'
+ get "tutorials/cancel_new",
+ to: "tutorials#cancel_new",
+ as: "cancel_new_tutorial"
- get 'tutorials/:id/assignments/:ass_id/bulk_download_submissions',
- to: 'tutorials#bulk_download_submissions',
- as: 'bulk_download_submissions'
+ get "tutorials/:id/assignments/:ass_id/bulk_download_submissions",
+ to: "tutorials#bulk_download_submissions",
+ as: "bulk_download_submissions"
- get 'tutorials/:id/assignments/:ass_id/bulk_download_corrections',
- to: 'tutorials#bulk_download_corrections',
- as: 'bulk_download_corrections'
+ get "tutorials/:id/assignments/:ass_id/bulk_download_corrections",
+ to: "tutorials#bulk_download_corrections",
+ as: "bulk_download_corrections"
- patch 'tutorials/:id/assignments/:ass_id/bulk_upload',
- to: 'tutorials#bulk_upload',
- as: 'bulk_upload_corrections'
+ patch "tutorials/:id/assignments/:ass_id/bulk_upload",
+ to: "tutorials#bulk_upload",
+ as: "bulk_upload_corrections"
- get 'tutorials/validate_certificate',
- to: 'tutorials#validate_certificate',
- as: 'validate_certificate_as_tutor'
+ get "tutorials/validate_certificate",
+ to: "tutorials#validate_certificate",
+ as: "validate_certificate_as_tutor"
- get 'tutorials/:id/assignments/:ass_id/export_teams',
- to: 'tutorials#export_teams',
- as: 'export_teams_to_csv'
+ get "tutorials/:id/assignments/:ass_id/export_teams",
+ to: "tutorials#export_teams",
+ as: "export_teams_to_csv"
resources :tutorials, only: [:new, :edit, :create, :update, :destroy]
# sections routes
- get 'sections/:id/display',
- to: 'sections#display',
- as: 'display_section'
+ get "sections/:id/display",
+ to: "sections#display",
+ as: "display_section"
resources :sections, except: [:index]
# terms routes
- get 'terms/cancel_term_edit',
- to: 'terms#cancel',
- as: 'cancel_term_edit'
+ get "terms/cancel_term_edit",
+ to: "terms#cancel",
+ as: "cancel_term_edit"
- post 'terms/set_active_term',
- to: 'terms#set_active',
- as: 'set_active_term'
+ post "terms/set_active_term",
+ to: "terms#set_active",
+ as: "set_active_term"
resources :terms, except: [:show]
# devise routes for users
- devise_for :users, controllers: { confirmations: 'confirmations',
- registrations: 'registrations',
- sessions: 'sessions' }
+ devise_for :users, controllers: { confirmations: "confirmations",
+ registrations: "registrations",
+ sessions: "sessions" }
# users routes
- get 'users/elevate',
- to: 'users#elevate',
- as: 'elevate_user'
+ get "users/elevate",
+ to: "users#elevate",
+ as: "elevate_user"
- get 'users/teacher/:teacher_id',
- to: 'users#teacher',
- as: 'teacher'
+ get "users/teacher/:teacher_id",
+ to: "users#teacher",
+ as: "teacher"
- get 'users/list_generic_users',
- to: 'users#list_generic_users',
- as: 'list_generic_users'
+ get "users/list_generic_users",
+ to: "users#list_generic_users",
+ as: "list_generic_users"
- get 'users/fill_user_select',
- to: 'users#fill_user_select',
- as: 'fill_user_select'
+ get "users/fill_user_select",
+ to: "users#fill_user_select",
+ as: "fill_user_select"
- get 'users/delete_account',
- to: 'users#delete_account',
- as: 'delete_account'
+ get "users/delete_account",
+ to: "users#delete_account",
+ as: "delete_account"
resources :users, only: [:index, :edit, :update, :destroy]
# watchlists routes
- get 'watchlists/add_medium/:medium_id',
- to: 'watchlists#add_medium',
- as: 'add_medium_to_watchlist'
+ get "watchlists/add_medium/:medium_id",
+ to: "watchlists#add_medium",
+ as: "add_medium_to_watchlist"
- get 'watchlists/add',
- to: 'watchlists#add',
- as: 'add_watchlist'
+ get "watchlists/add",
+ to: "watchlists#add",
+ as: "add_watchlist"
- get 'watchlists/rearrange',
- to: 'watchlists#update_order',
- as: 'rearrange_watchlist'
+ get "watchlists/rearrange",
+ to: "watchlists#update_order",
+ as: "rearrange_watchlist"
- get 'watchlists/change_visiblity',
- to: 'watchlists#change_visibility',
- as: 'change_visibility'
+ get "watchlists/change_visiblity",
+ to: "watchlists#change_visibility",
+ as: "change_visibility"
resources :watchlists
@@ -805,45 +804,44 @@
# erdbeere routes
- get 'examples/:id',
- to: 'erdbeere#show_example',
- as: 'erdbeere_example'
-
- post 'examples/find',
- to: 'erdbeere#find_example'
+ get "examples/:id",
+ to: "erdbeere#show_example",
+ as: "erdbeere_example"
- get 'properties/:id',
- to: 'erdbeere#show_property',
- as: 'erdbeere_property'
+ post "examples/find",
+ to: "erdbeere#find_example"
- get 'structures/:id',
- to: 'erdbeere#show_structure',
- as: 'erdbeere_structure'
+ get "properties/:id",
+ to: "erdbeere#show_property",
+ as: "erdbeere_property"
- get 'find_erdbeere_tags',
- to: 'erdbeere#find_tags',
- as: 'find_erdbeere_tags'
+ get "structures/:id",
+ to: "erdbeere#show_structure",
+ as: "erdbeere_structure"
- post 'update_erdbeere_tags',
- to: 'erdbeere#update_tags',
- as: 'update_erdbeere_tags'
+ get "find_erdbeere_tags",
+ to: "erdbeere#find_tags",
+ as: "find_erdbeere_tags"
- get 'edit_erdbeere_tags',
- to: 'erdbeere#edit_tags',
- as: 'edit_erdbeere_tags'
+ post "update_erdbeere_tags",
+ to: "erdbeere#update_tags",
+ as: "update_erdbeere_tags"
- get 'cancel_edit_erdbeere_tags',
- to: 'erdbeere#cancel_edit_tags',
- as: 'cancel_edit_erdbeere_tags'
+ get "edit_erdbeere_tags",
+ to: "erdbeere#edit_tags",
+ as: "edit_erdbeere_tags"
- get 'display_erdbeere_info',
- to: 'erdbeere#display_info',
- as: 'display_erdbeere_info'
+ get "cancel_edit_erdbeere_tags",
+ to: "erdbeere#cancel_edit_tags",
+ as: "cancel_edit_erdbeere_tags"
- get 'fill_realizations_select',
- to: 'erdbeere#fill_realizations_select',
- as: 'fill_realizations_select'
+ get "display_erdbeere_info",
+ to: "erdbeere#display_info",
+ as: "display_erdbeere_info"
+ get "fill_realizations_select",
+ to: "erdbeere#fill_realizations_select",
+ as: "fill_realizations_select"
# main routes
@@ -853,11 +851,11 @@
# https://stackoverflow.com/a/27507722/
devise_scope :user do
authenticated :user do
- root to: 'main#start'
+ root to: "main#start"
end
unauthenticated do
- root to: 'devise/sessions#new', as: :unauthenticated_root
+ root to: "devise/sessions#new", as: :unauthenticated_root
end
end
@@ -866,40 +864,40 @@
get "/login" => "devise/sessions#new"
end
- get 'error',
- to: 'main#error'
+ get "error",
+ to: "main#error"
- get 'main/news',
- to: 'main#news',
- as: 'news'
+ get "main/news",
+ to: "main#news",
+ as: "news"
- get 'main/comments',
- to: 'main#comments',
- as: 'comments'
+ get "main/comments",
+ to: "main#comments",
+ as: "comments"
- get 'main/start',
- to: 'main#start',
- as: 'start'
+ get "main/start",
+ to: "main#start",
+ as: "start"
# uploader routes
- mount ScreenshotUploader.upload_endpoint(:cache) => '/screenshots/upload'
- mount ProfileimageUploader.upload_endpoint(:cache) => '/profile_image/upload'
- mount VideoUploader.upload_endpoint(:cache) => '/videos/upload'
- mount PdfUploader.upload_endpoint(:cache) => '/pdfs/upload'
- mount GeogebraUploader.upload_endpoint(:cache) => '/ggbs/upload'
- mount SubmissionUploader.upload_endpoint(:submission_cache) => '/submissions/upload'
- mount CorrectionUploader.upload_endpoint(:submission_cache) => '/corrections/upload'
- mount ZipUploader.upload_endpoint(:submission_cache) => '/packages/upload'
+ mount ScreenshotUploader.upload_endpoint(:cache) => "/screenshots/upload"
+ mount ProfileimageUploader.upload_endpoint(:cache) => "/profile_image/upload"
+ mount VideoUploader.upload_endpoint(:cache) => "/videos/upload"
+ mount PdfUploader.upload_endpoint(:cache) => "/pdfs/upload"
+ mount GeogebraUploader.upload_endpoint(:cache) => "/ggbs/upload"
+ mount SubmissionUploader.upload_endpoint(:submission_cache) => "/submissions/upload"
+ mount CorrectionUploader.upload_endpoint(:submission_cache) => "/corrections/upload"
+ mount ZipUploader.upload_endpoint(:submission_cache) => "/packages/upload"
# thredded routes
- mount Thredded::Engine => '/forum'
+ mount Thredded::Engine => "/forum"
# redirect bs requests to error page
- match '*path', to: 'main#error', via: :all
- match '/', to: 'main#error', via: %i[post put patch delete]
+ match "*path", to: "main#error", via: :all
+ match "/", to: "main#error", via: [:post, :put, :patch, :delete]
# For details on the DSL available within this file,
# see http://guides.rubyonrails.org/routing.html
diff --git a/db/interactions_migrate/20191209143820_create_interactions.rb b/db/interactions_migrate/20191209143820_create_interactions.rb
index 0db8fef09..60e05bbfe 100644
--- a/db/interactions_migrate/20191209143820_create_interactions.rb
+++ b/db/interactions_migrate/20191209143820_create_interactions.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateInteractions < ActiveRecord::Migration[6.0]
def change
create_table :interactions do |t|
@@ -5,3 +6,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/interactions_migrate/20191209165752_add_details_to_interaction.rb b/db/interactions_migrate/20191209165752_add_details_to_interaction.rb
index 468192b49..30bf23c6b 100644
--- a/db/interactions_migrate/20191209165752_add_details_to_interaction.rb
+++ b/db/interactions_migrate/20191209165752_add_details_to_interaction.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddDetailsToInteraction < ActiveRecord::Migration[6.0]
def change
add_column :interactions, :controller_name, :text
@@ -5,3 +6,4 @@ def change
add_column :interactions, :referrer_url, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/interactions_migrate/20191211155453_remove_details_from_interactions.rb b/db/interactions_migrate/20191211155453_remove_details_from_interactions.rb
index 14894cec6..7203200d3 100644
--- a/db/interactions_migrate/20191211155453_remove_details_from_interactions.rb
+++ b/db/interactions_migrate/20191211155453_remove_details_from_interactions.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveDetailsFromInteractions < ActiveRecord::Migration[6.0]
def change
remove_column :interactions, :controller_name, :text
remove_column :interactions, :action_name, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/interactions_migrate/20191218131526_create_probes.rb b/db/interactions_migrate/20191218131526_create_probes.rb
index 07f213fa7..9086a559d 100644
--- a/db/interactions_migrate/20191218131526_create_probes.rb
+++ b/db/interactions_migrate/20191218131526_create_probes.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateProbes < ActiveRecord::Migration[6.0]
def change
create_table :probes do |t|
@@ -10,3 +11,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20170731143601_null_migration.rb b/db/migrate/20170731143601_null_migration.rb
index 00fed8d9d..d5f8c375e 100644
--- a/db/migrate/20170731143601_null_migration.rb
+++ b/db/migrate/20170731143601_null_migration.rb
@@ -28,7 +28,8 @@ def up
t.string "heading"
t.text "link"
t.string "question_list"
- t.index ["teachable_type", "teachable_id"], name: "index_assets_on_teachable_type_and_teachable_id"
+ t.index ["teachable_type", "teachable_id"],
+ name: "index_assets_on_teachable_type_and_teachable_id"
end
create_table "chapters", force: :cascade do |t|
@@ -45,7 +46,8 @@ def up
t.integer "linked_asset_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.index ["asset_id", "linked_asset_id"], name: "index_connections_on_asset_id_and_linked_asset_id", unique: true
+ t.index ["asset_id", "linked_asset_id"],
+ name: "index_connections_on_asset_id_and_linked_asset_id", unique: true
t.index ["asset_id"], name: "index_connections_on_asset_id"
t.index ["linked_asset_id"], name: "index_connections_on_linked_asset_id"
end
@@ -149,7 +151,8 @@ def up
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["related_tag_id"], name: "index_relations_on_related_tag_id"
- t.index ["tag_id", "related_tag_id"], name: "index_relations_on_tag_id_and_related_tag_id", unique: true
+ t.index ["tag_id", "related_tag_id"], name: "index_relations_on_tag_id_and_related_tag_id",
+ unique: true
t.index ["tag_id"], name: "index_relations_on_tag_id"
end
@@ -194,6 +197,6 @@ def up
end
def down
- raise ActiveRecord::IrreversibleMigration
+ raise ActiveRecord::IrreversibleMigration
end
end
diff --git a/db/migrate/20170909120217_devise_create_users.rb b/db/migrate/20170909120217_devise_create_users.rb
index 060217e13..3d690c60d 100644
--- a/db/migrate/20170909120217_devise_create_users.rb
+++ b/db/migrate/20170909120217_devise_create_users.rb
@@ -26,11 +26,11 @@ def change
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
- # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
+ # Only if lock strategy is :failed_attempts
+ # t.integer :failed_attempts, default: 0, null: false
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
-
t.timestamps null: false
end
diff --git a/db/migrate/20170914162323_delete_asset_tag_join.rb b/db/migrate/20170914162323_delete_asset_tag_join.rb
index 4e71da5e4..182bfb3a7 100644
--- a/db/migrate/20170914162323_delete_asset_tag_join.rb
+++ b/db/migrate/20170914162323_delete_asset_tag_join.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class DeleteAssetTagJoin < ActiveRecord::Migration[5.1]
def change
drop_table :asset_tag_joins
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20170919123229_add_admin_to_users.rb b/db/migrate/20170919123229_add_admin_to_users.rb
index 4b01c9bdd..592b4d858 100644
--- a/db/migrate/20170919123229_add_admin_to_users.rb
+++ b/db/migrate/20170919123229_add_admin_to_users.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddAdminToUsers < ActiveRecord::Migration[5.1]
def change
add_column :users, :admin, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171001204632_drop_asset.rb b/db/migrate/20171001204632_drop_asset.rb
index f27dfb5ce..0780c2ae6 100644
--- a/db/migrate/20171001204632_drop_asset.rb
+++ b/db/migrate/20171001204632_drop_asset.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class DropAsset < ActiveRecord::Migration[5.1]
def change
drop_table :assets
@@ -5,3 +6,4 @@ def change
drop_table :connections
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171009142032_add_modules_to_lecture.rb b/db/migrate/20171009142032_add_modules_to_lecture.rb
index b7c256f95..7a173d077 100644
--- a/db/migrate/20171009142032_add_modules_to_lecture.rb
+++ b/db/migrate/20171009142032_add_modules_to_lecture.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddModulesToLecture < ActiveRecord::Migration[5.1]
def change
add_column :lectures, :kaviar, :boolean
@@ -7,3 +8,4 @@ def change
add_column :lectures, :erdbeere, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171011122408_add_confirmable_to_devise.rb b/db/migrate/20171011122408_add_confirmable_to_devise.rb
index b5843412b..a6a56f00b 100644
--- a/db/migrate/20171011122408_add_confirmable_to_devise.rb
+++ b/db/migrate/20171011122408_add_confirmable_to_devise.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddConfirmableToDevise < ActiveRecord::Migration[5.1]
def up
add_column :users, :confirmation_token, :string
@@ -11,3 +12,4 @@ def down
remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171011171726_remove_confirmablefrom_devise.rb b/db/migrate/20171011171726_remove_confirmablefrom_devise.rb
index 5394189cc..b309e9881 100644
--- a/db/migrate/20171011171726_remove_confirmablefrom_devise.rb
+++ b/db/migrate/20171011171726_remove_confirmablefrom_devise.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class RemoveConfirmablefromDevise < ActiveRecord::Migration[5.1]
def change
remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171016171419_add_kiwi_to_lecture.rb b/db/migrate/20171016171419_add_kiwi_to_lecture.rb
index 2e6f6bfe4..d9ebef46e 100644
--- a/db/migrate/20171016171419_add_kiwi_to_lecture.rb
+++ b/db/migrate/20171016171419_add_kiwi_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddKiwiToLecture < ActiveRecord::Migration[5.1]
def change
add_column :lectures, :kiwi, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20171021135749_add_extras_to_medium.rb b/db/migrate/20171021135749_add_extras_to_medium.rb
index 4bc57f73a..a88c3fcdd 100644
--- a/db/migrate/20171021135749_add_extras_to_medium.rb
+++ b/db/migrate/20171021135749_add_extras_to_medium.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddExtrasToMedium < ActiveRecord::Migration[5.1]
def change
add_column :media, :extras_link, :text
add_column :media, :extras_description, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180524065013_add_consents_to_user.rb b/db/migrate/20180524065013_add_consents_to_user.rb
index 374e87869..8d1c6637f 100644
--- a/db/migrate/20180524065013_add_consents_to_user.rb
+++ b/db/migrate/20180524065013_add_consents_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddConsentsToUser < ActiveRecord::Migration[5.1]
def change
add_column :users, :consents, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180524103749_remove_trackable_from_user.rb b/db/migrate/20180524103749_remove_trackable_from_user.rb
index c94ab4002..c3b666aa0 100644
--- a/db/migrate/20180524103749_remove_trackable_from_user.rb
+++ b/db/migrate/20180524103749_remove_trackable_from_user.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemoveTrackableFromUser < ActiveRecord::Migration[5.1]
def change
remove_column :users, :sign_in_count, :integer
@@ -7,3 +8,4 @@ def change
remove_column :users, :last_sign_in_ip, :string
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180806092317_add_fields_to_course_user_join.rb b/db/migrate/20180806092317_add_fields_to_course_user_join.rb
index 966bd4999..d4112645a 100644
--- a/db/migrate/20180806092317_add_fields_to_course_user_join.rb
+++ b/db/migrate/20180806092317_add_fields_to_course_user_join.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddFieldsToCourseUserJoin < ActiveRecord::Migration[5.2]
def change
add_column :course_user_joins, :sesam, :boolean
@@ -7,3 +8,4 @@ def change
add_column :course_user_joins, :reste, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180806100940_add_news_to_course_user_join.rb b/db/migrate/20180806100940_add_news_to_course_user_join.rb
index 55ac8c6f0..1324c210f 100644
--- a/db/migrate/20180806100940_add_news_to_course_user_join.rb
+++ b/db/migrate/20180806100940_add_news_to_course_user_join.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddNewsToCourseUserJoin < ActiveRecord::Migration[5.2]
def change
add_column :course_user_joins, :news, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180806124930_add_edited_profile_to_user.rb b/db/migrate/20180806124930_add_edited_profile_to_user.rb
index e6e8b30d6..11b33edce 100644
--- a/db/migrate/20180806124930_add_edited_profile_to_user.rb
+++ b/db/migrate/20180806124930_add_edited_profile_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddEditedProfileToUser < ActiveRecord::Migration[5.2]
def change
add_column :users, :edited_profile, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180808092444_remove_properties_from_lecture.rb b/db/migrate/20180808092444_remove_properties_from_lecture.rb
index 60d94721f..4d3c9729d 100644
--- a/db/migrate/20180808092444_remove_properties_from_lecture.rb
+++ b/db/migrate/20180808092444_remove_properties_from_lecture.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemovePropertiesFromLecture < ActiveRecord::Migration[5.2]
def change
remove_column :lectures, :kaviar, :boolean
@@ -8,3 +9,4 @@ def change
remove_column :lectures, :kiwi, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180808110436_rename_properties_in_course_user_join.rb b/db/migrate/20180808110436_rename_properties_in_course_user_join.rb
index a774ad3ba..fad7040c7 100644
--- a/db/migrate/20180808110436_rename_properties_in_course_user_join.rb
+++ b/db/migrate/20180808110436_rename_properties_in_course_user_join.rb
@@ -5,6 +5,6 @@ def change
rename_column :course_user_joins, :erdbeere, :erdbeere?
rename_column :course_user_joins, :kiwi, :kiwi?
rename_column :course_user_joins, :reste, :reste?
- rename_column :course_user_joins, :news, :news?
+ rename_column :course_user_joins, :news, :news?
end
end
diff --git a/db/migrate/20180816125615_add_teacher_to_user.rb b/db/migrate/20180816125615_add_teacher_to_user.rb
index d9f27341a..e958ae825 100644
--- a/db/migrate/20180816125615_add_teacher_to_user.rb
+++ b/db/migrate/20180816125615_add_teacher_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddTeacherToUser < ActiveRecord::Migration[5.2]
def change
add_column :users, :teacher, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180819151835_create_editable_user_join_table.rb b/db/migrate/20180819151835_create_editable_user_join_table.rb
index 74d63da79..b26a7950b 100644
--- a/db/migrate/20180819151835_create_editable_user_join_table.rb
+++ b/db/migrate/20180819151835_create_editable_user_join_table.rb
@@ -1,11 +1,15 @@
+# rubocop:disable Rails/
class CreateEditableUserJoinTable < ActiveRecord::Migration[5.2]
def change
create_table :editable_user_joins do |t|
t.integer :editable_id
t.string :editable_type
t.integer :user_id
- end
- add_index :editable_user_joins, [:editable_id, :editable_type, :user_id], :name => 'polymorphic_many_to_many_idx'
- add_index :editable_user_joins, [:editable_id, :editable_type], :name => 'polymorphic_editable_idx'
+ end
+ add_index :editable_user_joins, [:editable_id, :editable_type, :user_id],
+ name: "polymorphic_many_to_many_idx"
+ add_index :editable_user_joins, [:editable_id, :editable_type],
+ name: "polymorphic_editable_idx"
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180820123437_add_editor_and_name_to_user.rb b/db/migrate/20180820123437_add_editor_and_name_to_user.rb
index 6ed47b493..9a3bea6fd 100644
--- a/db/migrate/20180820123437_add_editor_and_name_to_user.rb
+++ b/db/migrate/20180820123437_add_editor_and_name_to_user.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddEditorAndNameToUser < ActiveRecord::Migration[5.2]
def change
add_column :users, :editor, :boolean
add_column :users, :name, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180820152008_remove_teacher_and_teacher_id_from_user.rb b/db/migrate/20180820152008_remove_teacher_and_teacher_id_from_user.rb
index cbd5e22fe..e628f5e0a 100644
--- a/db/migrate/20180820152008_remove_teacher_and_teacher_id_from_user.rb
+++ b/db/migrate/20180820152008_remove_teacher_and_teacher_id_from_user.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveTeacherAndTeacherIdFromUser < ActiveRecord::Migration[5.2]
def change
remove_column :users, :teacher, :boolean
remove_column :users, :teacher_id, :integer
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180821132727_remove_teacher_fragments.rb b/db/migrate/20180821132727_remove_teacher_fragments.rb
index a9d0ef690..7cd044f95 100644
--- a/db/migrate/20180821132727_remove_teacher_fragments.rb
+++ b/db/migrate/20180821132727_remove_teacher_fragments.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveTeacherFragments < ActiveRecord::Migration[5.2]
def change
remove_column :lectures, :teacher_id
remove_reference :users, :teacher, foreign_key: true, index: true
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180821140606_add_teacher_again_to_lecture.rb b/db/migrate/20180821140606_add_teacher_again_to_lecture.rb
index 0dd7f7d29..cf43dbd30 100644
--- a/db/migrate/20180821140606_add_teacher_again_to_lecture.rb
+++ b/db/migrate/20180821140606_add_teacher_again_to_lecture.rb
@@ -1,7 +1,7 @@
class AddTeacherAgainToLecture < ActiveRecord::Migration[5.2]
def change
-# add_reference :lectures, :teacher, foreign_key: true
- add_column :lectures, :teacher_id, :integer
+ # add_reference :lectures, :teacher, foreign_key: true
+ add_column :lectures, :teacher_id, :integer
add_index :lectures, :teacher_id
end
end
diff --git a/db/migrate/20180830080855_add_position_to_section.rb b/db/migrate/20180830080855_add_position_to_section.rb
index 96c99a6e9..fcfcc5db6 100644
--- a/db/migrate/20180830080855_add_position_to_section.rb
+++ b/db/migrate/20180830080855_add_position_to_section.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddPositionToSection < ActiveRecord::Migration[5.2]
def change
add_column :sections, :position, :integer
@@ -8,3 +9,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180830081938_add_position_to_chapter.rb b/db/migrate/20180830081938_add_position_to_chapter.rb
index dd6f9b336..2fc22b442 100644
--- a/db/migrate/20180830081938_add_position_to_chapter.rb
+++ b/db/migrate/20180830081938_add_position_to_chapter.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddPositionToChapter < ActiveRecord::Migration[5.2]
def change
add_column :chapters, :position, :integer
@@ -8,3 +9,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180830085749_add_absolute_numbering_to_lecture.rb b/db/migrate/20180830085749_add_absolute_numbering_to_lecture.rb
index 10771051d..32f5c87a3 100644
--- a/db/migrate/20180830085749_add_absolute_numbering_to_lecture.rb
+++ b/db/migrate/20180830085749_add_absolute_numbering_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddAbsoluteNumberingToLecture < ActiveRecord::Migration[5.2]
def change
add_column :lectures, :absolute_numbering, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180830121324_remove_numbers_from_section.rb b/db/migrate/20180830121324_remove_numbers_from_section.rb
index 877b9cfa7..290974ed6 100644
--- a/db/migrate/20180830121324_remove_numbers_from_section.rb
+++ b/db/migrate/20180830121324_remove_numbers_from_section.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveNumbersFromSection < ActiveRecord::Migration[5.2]
def change
remove_column :sections, :number, :integer
remove_column :sections, :number_alt, :string
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180905085400_add_shrine_columns_to_media.rb b/db/migrate/20180905085400_add_shrine_columns_to_media.rb
index fb3880227..b9ffffec7 100644
--- a/db/migrate/20180905085400_add_shrine_columns_to_media.rb
+++ b/db/migrate/20180905085400_add_shrine_columns_to_media.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddShrineColumnsToMedia < ActiveRecord::Migration[5.2]
def change
add_column :media, :video_data, :text
@@ -5,3 +6,4 @@ def change
add_column :media, :manuscript_data, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180905134510_import_files_to_shrine.rb b/db/migrate/20180905134510_import_files_to_shrine.rb
index b58862d57..e2ee0ffcc 100644
--- a/db/migrate/20180905134510_import_files_to_shrine.rb
+++ b/db/migrate/20180905134510_import_files_to_shrine.rb
@@ -1,33 +1,32 @@
+# rubocop:disable Style/StringConcatenation, Security/Open, Rails/
class ImportFilesToShrine < ActiveRecord::Migration[5.2]
def change
Medium.all.each do |m|
if m.video_thumbnail_link.present?
screenshot = open(m.video_thumbnail_link)
- file = Tempfile.new([m.title + '-', '.png'])
+ file = Tempfile.new([m.title + "-", ".png"])
file.binmode
file.write open(screenshot).read
file.rewind
- file
m.update(screenshot: file)
end
if m.manuscript_link.present?
manuscript = open(m.manuscript_link)
- file = Tempfile.new([m.title + '-', '.pdf'])
+ file = Tempfile.new([m.title + "-", ".pdf"])
file.binmode
file.write open(manuscript).read
file.rewind
- file
m.update(manuscript: file)
end
- if m.video_file_link.present?
- video = open(m.video_file_link)
- file = Tempfile.new([m.title + '-', '.mp4'])
- file.binmode
- file.write open(video).read
- file.rewind
- file
- m.update(video: file)
- end
+ next unless m.video_file_link.present?
+
+ video = open(m.video_file_link)
+ file = Tempfile.new([m.title + "-", ".mp4"])
+ file.binmode
+ file.write open(video).read
+ file.rewind
+ m.update(video: file)
end
end
end
+# rubocop:enable Style/StringConcatenation, Security/Open, Rails/
diff --git a/db/migrate/20180906122130_remove_a_lot_of_columns_from_medium.rb b/db/migrate/20180906122130_remove_a_lot_of_columns_from_medium.rb
index e27507196..998b7bb0c 100644
--- a/db/migrate/20180906122130_remove_a_lot_of_columns_from_medium.rb
+++ b/db/migrate/20180906122130_remove_a_lot_of_columns_from_medium.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemoveALotOfColumnsFromMedium < ActiveRecord::Migration[5.2]
def change
remove_column :media, :width, :integer
@@ -12,3 +13,4 @@ def change
remove_column :media, :video_player, :string
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180908101213_remove_questions_from_medium.rb b/db/migrate/20180908101213_remove_questions_from_medium.rb
index ad5c2c50f..4a05cb42a 100644
--- a/db/migrate/20180908101213_remove_questions_from_medium.rb
+++ b/db/migrate/20180908101213_remove_questions_from_medium.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveQuestionsFromMedium < ActiveRecord::Migration[5.2]
def change
remove_column :media, :question_id, :integer
remove_column :media, :question_list, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180909152728_create_referrals.rb b/db/migrate/20180909152728_create_referrals.rb
index 78cf1b342..2671771e7 100644
--- a/db/migrate/20180909152728_create_referrals.rb
+++ b/db/migrate/20180909152728_create_referrals.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateReferrals < ActiveRecord::Migration[5.2]
def change
create_table :referrals do |t|
@@ -13,3 +14,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180911085149_add_medium_self_items.rb b/db/migrate/20180911085149_add_medium_self_items.rb
index b0ccd2a5c..9d3eda96f 100644
--- a/db/migrate/20180911085149_add_medium_self_items.rb
+++ b/db/migrate/20180911085149_add_medium_self_items.rb
@@ -1,9 +1,9 @@
+# rubocop:disable Rails/
class AddMediumSelfItems < ActiveRecord::Migration[5.2]
def change
Medium.all.each do |m|
- unless Item.where(sort: 'self', medium: m).present?
- Item.create(sort: 'self', medium: m)
- end
+ Item.create(sort: "self", medium: m) unless Item.where(sort: "self", medium: m).present?
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180913104612_add_link_to_referral.rb b/db/migrate/20180913104612_add_link_to_referral.rb
index a57b436f7..3370c8cc8 100644
--- a/db/migrate/20180913104612_add_link_to_referral.rb
+++ b/db/migrate/20180913104612_add_link_to_referral.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddLinkToReferral < ActiveRecord::Migration[5.2]
def change
add_column :referrals, :link, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20180913110737_add_medium_link_to_referral.rb b/db/migrate/20180913110737_add_medium_link_to_referral.rb
index c414cd2b7..85140d2c8 100644
--- a/db/migrate/20180913110737_add_medium_link_to_referral.rb
+++ b/db/migrate/20180913110737_add_medium_link_to_referral.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddMediumLinkToReferral < ActiveRecord::Migration[5.2]
def change
add_column :referrals, :medium_link, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20181015141212_remove_booleans_from_referral.rb b/db/migrate/20181015141212_remove_booleans_from_referral.rb
index b823d8aa2..2bcdf79c1 100644
--- a/db/migrate/20181015141212_remove_booleans_from_referral.rb
+++ b/db/migrate/20181015141212_remove_booleans_from_referral.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemoveBooleansFromReferral < ActiveRecord::Migration[5.2]
def change
remove_column :referrals, :video, :boolean
@@ -5,3 +6,4 @@ def change
remove_column :referrals, :medium_link, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20181129113233_rename_reste_to_nuesse.rb b/db/migrate/20181129113233_rename_reste_to_nuesse.rb
index a8a5e4406..c20579687 100644
--- a/db/migrate/20181129113233_rename_reste_to_nuesse.rb
+++ b/db/migrate/20181129113233_rename_reste_to_nuesse.rb
@@ -2,4 +2,4 @@ class RenameResteToNuesse < ActiveRecord::Migration[5.2]
def change
rename_column :course_user_joins, :reste?, :nuesse?
end
-end
\ No newline at end of file
+end
diff --git a/db/migrate/20181129115315_rename_media_sort_reste_to_nuesse.rb b/db/migrate/20181129115315_rename_media_sort_reste_to_nuesse.rb
index d9c22f6c6..eba6c8ff9 100644
--- a/db/migrate/20181129115315_rename_media_sort_reste_to_nuesse.rb
+++ b/db/migrate/20181129115315_rename_media_sort_reste_to_nuesse.rb
@@ -1,7 +1,9 @@
+# rubocop:disable Rails/
class RenameMediaSortResteToNuesse < ActiveRecord::Migration[5.2]
def change
- Medium.where(sort: 'Reste').each do |m|
- m.update(sort: 'Nuesse')
+ Medium.where(sort: "Reste").each do |m|
+ m.update(sort: "Nuesse")
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20181207142648_create_activity_notification_tables.rb b/db/migrate/20181207142648_create_activity_notification_tables.rb
index cd50cf2a4..77b28eb3f 100644
--- a/db/migrate/20181207142648_create_activity_notification_tables.rb
+++ b/db/migrate/20181207142648_create_activity_notification_tables.rb
@@ -6,9 +6,9 @@ def change
t.belongs_to :target, polymorphic: true, index: true, null: false
t.belongs_to :notifiable, polymorphic: true, index: true, null: false
t.string :key, null: false
- t.belongs_to :group, polymorphic: true, index: true
- t.integer :group_owner_id, index: true
- t.belongs_to :notifier, polymorphic: true, index: true
+ t.belongs_to :group, polymorphic: true, index: true
+ t.integer :group_owner_id, index: true
+ t.belongs_to :notifier, polymorphic: true, index: true
t.text :parameters
t.datetime :opened_at
diff --git a/db/migrate/20181210173053_remove_activity_notification.rb b/db/migrate/20181210173053_remove_activity_notification.rb
index 484bb4628..cbebe211b 100644
--- a/db/migrate/20181210173053_remove_activity_notification.rb
+++ b/db/migrate/20181210173053_remove_activity_notification.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class RemoveActivityNotification < ActiveRecord::Migration[5.2]
def change
drop_table :notifications
drop_table :subscriptions
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20181222160210_create_announcements.rb b/db/migrate/20181222160210_create_announcements.rb
index 2fc721ff5..ee33acc1d 100644
--- a/db/migrate/20181222160210_create_announcements.rb
+++ b/db/migrate/20181222160210_create_announcements.rb
@@ -2,7 +2,7 @@ class CreateAnnouncements < ActiveRecord::Migration[5.2]
def change
create_table :announcements do |t|
t.references :lecture, foreign_key: true
- t.references :announcer, foreign_key: {to_table: :users}
+ t.references :announcer, foreign_key: { to_table: :users }
t.text :details
t.timestamps
diff --git a/db/migrate/20181222164908_add_index_to_notification.rb b/db/migrate/20181222164908_add_index_to_notification.rb
index cbe6e8d16..94f5b0e10 100644
--- a/db/migrate/20181222164908_add_index_to_notification.rb
+++ b/db/migrate/20181222164908_add_index_to_notification.rb
@@ -1,5 +1,5 @@
class AddIndexToNotification < ActiveRecord::Migration[5.2]
def change
- add_index :notifications, :recipient_id
+ add_index :notifications, :recipient_id
end
end
diff --git a/db/migrate/20181222165544_add_notifiable_index_to_notification.rb b/db/migrate/20181222165544_add_notifiable_index_to_notification.rb
index caf788a28..a1de4c062 100644
--- a/db/migrate/20181222165544_add_notifiable_index_to_notification.rb
+++ b/db/migrate/20181222165544_add_notifiable_index_to_notification.rb
@@ -1,5 +1,5 @@
class AddNotifiableIndexToNotification < ActiveRecord::Migration[5.2]
def change
- add_index :notifications, [:notifiable_id, :notifiable_type]
+ add_index :notifications, [:notifiable_id, :notifiable_type]
end
end
diff --git a/db/migrate/20190106121300_add_no_notifications_to_user.rb b/db/migrate/20190106121300_add_no_notifications_to_user.rb
index 6d30e764b..a2bce1afe 100644
--- a/db/migrate/20190106121300_add_no_notifications_to_user.rb
+++ b/db/migrate/20190106121300_add_no_notifications_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddNoNotificationsToUser < ActiveRecord::Migration[5.2]
def change
add_column :users, :no_notifications, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190126161457_create_thredded.thredded.rb b/db/migrate/20190126161457_create_thredded.thredded.rb
index b4c276961..c37f4bd1d 100644
--- a/db/migrate/20190126161457_create_thredded.thredded.rb
+++ b/db/migrate/20190126161457_create_thredded.thredded.rb
@@ -1,10 +1,9 @@
-# frozen_string_literal: true
+# rubocop:disable Rails/
+
# This migration comes from thredded (originally 20160329231848)
-require 'thredded/base_migration'
+require "thredded/base_migration"
-# rubocop:disable Metrics/ClassLength
-# rubocop:disable Metrics/MethodLength
class CreateThredded < Thredded::BaseMigration
def change
unless table_exists?(:friendly_id_slugs)
@@ -17,8 +16,9 @@ def change
t.datetime :created_at
end
add_index :friendly_id_slugs, :sluggable_id
- add_index :friendly_id_slugs, %i[slug sluggable_type], length: { slug: 140, sluggable_type: 50 }
- add_index :friendly_id_slugs, %i[slug sluggable_type scope],
+ add_index :friendly_id_slugs, [:slug, :sluggable_type],
+ length: { slug: 140, sluggable_type: 50 }
+ add_index :friendly_id_slugs, [:slug, :sluggable_type, :scope],
length: { slug: 70, sluggable_type: 50, scope: 70 },
unique: true
add_index :friendly_id_slugs, :sluggable_type
@@ -30,7 +30,7 @@ def change
t.text :description
t.timestamps null: false
t.text :slug, null: false
- t.index %i[messageboard_id slug],
+ t.index [:messageboard_id, :slug],
name: :index_thredded_categories_on_messageboard_id_and_slug,
unique: true,
length: { slug: max_key_length }
@@ -61,27 +61,29 @@ def change
create_table :thredded_posts do |t|
t.references :user, type: user_id_type, index: false
t.text :content, limit: 65_535
- t.string :source, limit: 191, default: 'web'
+ t.string :source, limit: 191, default: "web"
t.references :postable, null: false, index: false
t.references :messageboard, null: false, index: false
t.integer :moderation_state, null: false
t.timestamps null: false
- t.index %i[moderation_state updated_at],
+ t.index [:moderation_state, :updated_at],
order: { updated_at: :asc },
- name: :index_thredded_posts_for_display
+ name: :index_thredded_posts_for_display
t.index [:messageboard_id], name: :index_thredded_posts_on_messageboard_id
t.index [:postable_id], name: :index_thredded_posts_on_postable_id
- t.index %i[postable_id created_at], name: :index_thredded_posts_on_postable_id_and_created_at
+ t.index [:postable_id, :created_at], name: :index_thredded_posts_on_postable_id_and_created_at
t.index [:user_id], name: :index_thredded_posts_on_user_id
end
- DbTextSearch::FullText.add_index connection, :thredded_posts, :content, name: :thredded_posts_content_fts
+ DbTextSearch::FullText.add_index connection, :thredded_posts, :content,
+ name: :thredded_posts_content_fts
create_table :thredded_private_posts do |t|
t.references :user, type: user_id_type, index: false
t.text :content, limit: 65_535
t.references :postable, null: false, index: false
t.timestamps null: false
- t.index %i[postable_id created_at], name: :index_thredded_private_posts_on_postable_id_and_created_at
+ t.index [:postable_id, :created_at],
+ name: :index_thredded_private_posts_on_postable_id_and_created_at
end
create_table :thredded_private_topics do |t|
@@ -129,9 +131,9 @@ def change
t.integer :moderation_state, null: false
t.datetime :last_post_at
t.timestamps null: false
- t.index %i[moderation_state sticky updated_at],
+ t.index [:moderation_state, :sticky, :updated_at],
order: { sticky: :desc, updated_at: :desc },
- name: :index_thredded_topics_for_display
+ name: :index_thredded_topics_for_display
t.index [:last_post_at], name: :index_thredded_topics_on_last_post_at
t.index [:hash_id], name: :index_thredded_topics_on_hash_id
t.index [:slug],
@@ -141,7 +143,8 @@ def change
t.index [:messageboard_id], name: :index_thredded_topics_on_messageboard_id
t.index [:user_id], name: :index_thredded_topics_on_user_id
end
- DbTextSearch::FullText.add_index connection, :thredded_topics, :title, name: :thredded_topics_title_fts
+ DbTextSearch::FullText.add_index connection, :thredded_topics, :title,
+ name: :thredded_topics_title_fts
create_table :thredded_user_details do |t|
t.references :user, type: user_id_type, null: false, index: false
@@ -152,21 +155,21 @@ def change
t.integer :moderation_state, null: false, default: 0 # pending_moderation
t.timestamp :moderation_state_changed_at
t.timestamps null: false
- t.index %i[moderation_state moderation_state_changed_at],
+ t.index [:moderation_state, :moderation_state_changed_at],
order: { moderation_state_changed_at: :desc },
name: :index_thredded_user_details_for_moderations
- t.index %i[latest_activity_at], name: :index_thredded_user_details_on_latest_activity_at
- t.index %i[user_id], name: :index_thredded_user_details_on_user_id, unique: true
+ t.index [:latest_activity_at], name: :index_thredded_user_details_on_latest_activity_at
+ t.index [:user_id], name: :index_thredded_user_details_on_user_id, unique: true
end
create_table :thredded_messageboard_users do |t|
t.references :thredded_user_detail, null: false, index: false
t.references :thredded_messageboard, null: false, index: false
t.datetime :last_seen_at, null: false
- t.index %i[thredded_messageboard_id thredded_user_detail_id],
+ t.index [:thredded_messageboard_id, :thredded_user_detail_id],
name: :index_thredded_messageboard_users_primary,
unique: true
- t.index %i[thredded_messageboard_id last_seen_at],
+ t.index [:thredded_messageboard_id, :last_seen_at],
name: :index_thredded_messageboard_users_for_recently_active
end
add_foreign_key :thredded_messageboard_users, :thredded_user_details,
@@ -188,24 +191,27 @@ def change
t.boolean :follow_topics_on_mention, default: true, null: false
t.boolean :auto_follow_topics, default: false, null: false
t.timestamps null: false
- t.index %i[user_id messageboard_id],
+ t.index [:user_id, :messageboard_id],
name: :thredded_user_messageboard_preferences_user_id_messageboard_id,
unique: true
end
- %i[topic private_topic].each do |topics_table|
+ [:topic, :private_topic].each do |topics_table|
table_name = :"thredded_user_#{topics_table}_read_states"
create_table table_name do |t|
- t.references :messageboard, null: false, index: true if table_name == :thredded_user_topic_read_states
+ if table_name == :thredded_user_topic_read_states
+ t.references :messageboard, null: false,
+ index: true
+ end
t.references :user, type: user_id_type, null: false, index: false
t.references :postable, null: false, index: false
t.integer :unread_posts_count, default: 0, null: false
t.integer :read_posts_count, :integer, default: 0, null: false
t.timestamp :read_at, null: false
- t.index %i[user_id postable_id], name: :"#{table_name}_user_postable", unique: true
+ t.index [:user_id, :postable_id], name: :"#{table_name}_user_postable", unique: true
end
end
- add_index :thredded_user_topic_read_states, %i[user_id messageboard_id],
+ add_index :thredded_user_topic_read_states, [:user_id, :messageboard_id],
name: :thredded_user_topic_read_states_user_messageboard
create_table :thredded_messageboard_groups do |t|
@@ -219,7 +225,7 @@ def change
t.references :topic, null: false, index: false
t.datetime :created_at, null: false
t.integer :reason, limit: 1
- t.index %i[user_id topic_id], name: :thredded_user_topic_follows_user_topic, unique: true
+ t.index [:user_id, :topic_id], name: :thredded_user_topic_follows_user_topic, unique: true
end
create_table :thredded_post_moderation_records do |t|
@@ -232,32 +238,33 @@ def change
t.integer :moderation_state, null: false
t.integer :previous_moderation_state, null: false
t.timestamp :created_at, null: false
- t.index %i[messageboard_id created_at],
+ t.index [:messageboard_id, :created_at],
order: { created_at: :desc },
- name: :index_thredded_moderation_records_for_display
+ name: :index_thredded_moderation_records_for_display
end
create_table :thredded_notifications_for_private_topics do |t|
t.references :user, null: false, index: false, type: user_id_type
t.string :notifier_key, null: false, limit: 90
t.boolean :enabled, default: true, null: false
- t.index %i[user_id notifier_key],
- name: 'thredded_notifications_for_private_topics_unique', unique: true
+ t.index [:user_id, :notifier_key],
+ name: "thredded_notifications_for_private_topics_unique", unique: true
end
+
create_table :thredded_notifications_for_followed_topics do |t|
t.references :user, null: false, index: false, type: user_id_type
t.string :notifier_key, null: false, limit: 90
t.boolean :enabled, default: true, null: false
- t.index %i[user_id notifier_key],
- name: 'thredded_notifications_for_followed_topics_unique', unique: true
+ t.index [:user_id, :notifier_key],
+ name: "thredded_notifications_for_followed_topics_unique", unique: true
end
create_table :thredded_messageboard_notifications_for_followed_topics do |t|
t.references :user, null: false, index: false, type: user_id_type
t.references :messageboard, null: false, index: false
t.string :notifier_key, null: false, limit: 90
t.boolean :enabled, default: true, null: false
- t.index %i[user_id messageboard_id notifier_key],
- name: 'thredded_messageboard_notifications_for_followed_topics_unique', unique: true
+ t.index [:user_id, :messageboard_id, :notifier_key],
+ name: "thredded_messageboard_notifications_for_followed_topics_unique", unique: true
end
create_table :thredded_user_post_notifications do |t|
@@ -265,13 +272,15 @@ def change
t.references :post, null: false, index: false
t.datetime :notified_at, null: false
t.index :post_id, name: :index_thredded_user_post_notifications_on_post_id
- t.index %i[user_id post_id], name: :index_thredded_user_post_notifications_on_user_id_and_post_id, unique: true
+ t.index [:user_id, :post_id],
+ name: :index_thredded_user_post_notifications_on_user_id_and_post_id, unique: true
end
+
add_foreign_key :thredded_user_post_notifications,
Thredded.user_class.table_name, column: :user_id, on_delete: :cascade
add_foreign_key :thredded_user_post_notifications,
:thredded_posts, column: :post_id, on_delete: :cascade
end
end
-# rubocop:enable Metrics/MethodLength
-# rubocop:enable Metrics/ClassLength
+
+# rubocop:enable Rails/
diff --git a/db/migrate/20190127120458_change_nil_user_names_to_blank.rb b/db/migrate/20190127120458_change_nil_user_names_to_blank.rb
index 82106cdb3..0f5ee8a17 100644
--- a/db/migrate/20190127120458_change_nil_user_names_to_blank.rb
+++ b/db/migrate/20190127120458_change_nil_user_names_to_blank.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class ChangeNilUserNamesToBlank < ActiveRecord::Migration[5.2]
def change
- User.where(name: nil).update_all(name: '')
+ User.where(name: nil).update_all(name: "")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190127121403_change_blank_user_names_to_nutzer_in.rb b/db/migrate/20190127121403_change_blank_user_names_to_nutzer_in.rb
index 10cd3ad8e..70ca7b2a5 100644
--- a/db/migrate/20190127121403_change_blank_user_names_to_nutzer_in.rb
+++ b/db/migrate/20190127121403_change_blank_user_names_to_nutzer_in.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class ChangeBlankUserNamesToNutzerIn < ActiveRecord::Migration[5.2]
def change
- User.where(name: '').update_all(name: 'NutzerIn')
+ User.where(name: "").update_all(name: "NutzerIn")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190203110121_remove_extras_from_course_user_join.rb b/db/migrate/20190203110121_remove_extras_from_course_user_join.rb
index f9e547004..9cf851663 100644
--- a/db/migrate/20190203110121_remove_extras_from_course_user_join.rb
+++ b/db/migrate/20190203110121_remove_extras_from_course_user_join.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemoveExtrasFromCourseUserJoin < ActiveRecord::Migration[5.2]
def change
remove_column :course_user_joins, :sesam?, :boolean
@@ -7,3 +8,4 @@ def change
remove_column :course_user_joins, :nuesse?, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190204161127_add_organizational_to_lecture.rb b/db/migrate/20190204161127_add_organizational_to_lecture.rb
index 3dc1f1c6f..1119d6363 100644
--- a/db/migrate/20190204161127_add_organizational_to_lecture.rb
+++ b/db/migrate/20190204161127_add_organizational_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddOrganizationalToLecture < ActiveRecord::Migration[5.2]
def change
add_column :lectures, :organizational, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190207092000_add_muesli_to_lecture.rb b/db/migrate/20190207092000_add_muesli_to_lecture.rb
index 68f312fe6..a23e804ec 100644
--- a/db/migrate/20190207092000_add_muesli_to_lecture.rb
+++ b/db/migrate/20190207092000_add_muesli_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddMuesliToLecture < ActiveRecord::Migration[5.2]
def change
add_column :lectures, :muesli, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190211172104_add_released_to_medium.rb b/db/migrate/20190211172104_add_released_to_medium.rb
index 5f1161a5b..4f575fec6 100644
--- a/db/migrate/20190211172104_add_released_to_medium.rb
+++ b/db/migrate/20190211172104_add_released_to_medium.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddReleasedToMedium < ActiveRecord::Migration[5.2]
def change
add_column :media, :released, :text
- Medium.all.update_all(released: 'all')
+ Medium.all.update_all(released: "all")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190212143919_add_released_to_lecture.rb b/db/migrate/20190212143919_add_released_to_lecture.rb
index f20b83335..0e72e6601 100644
--- a/db/migrate/20190212143919_add_released_to_lecture.rb
+++ b/db/migrate/20190212143919_add_released_to_lecture.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddReleasedToLecture < ActiveRecord::Migration[5.2]
def change
add_column :lectures, :released, :text
- Lecture.all.update_all(released: 'all')
+ Lecture.all.update_all(released: "all")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190225103346_add_quarantine_to_item.rb b/db/migrate/20190225103346_add_quarantine_to_item.rb
index b234080e6..060c7514c 100644
--- a/db/migrate/20190225103346_add_quarantine_to_item.rb
+++ b/db/migrate/20190225103346_add_quarantine_to_item.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddQuarantineToItem < ActiveRecord::Migration[5.2]
def change
add_column :items, :quarantine, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190225142347_add_content_mode_to_lecture.rb b/db/migrate/20190225142347_add_content_mode_to_lecture.rb
index 03ac1eac6..e64218dba 100644
--- a/db/migrate/20190225142347_add_content_mode_to_lecture.rb
+++ b/db/migrate/20190225142347_add_content_mode_to_lecture.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddContentModeToLecture < ActiveRecord::Migration[5.2]
def change
add_column :lectures, :content_mode, :text
- Lecture.all.update_all(content_mode: 'media')
+ Lecture.all.update_all(content_mode: "media")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190225151323_replace_content_mode_media_by_video.rb b/db/migrate/20190225151323_replace_content_mode_media_by_video.rb
index d42639d6a..62678a0c2 100644
--- a/db/migrate/20190225151323_replace_content_mode_media_by_video.rb
+++ b/db/migrate/20190225151323_replace_content_mode_media_by_video.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class ReplaceContentModeMediaByVideo < ActiveRecord::Migration[5.2]
def change
- Lecture.all.update_all(content_mode: 'video')
+ Lecture.all.update_all(content_mode: "video")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190226102954_add_start_and_end_destination_to_lesson.rb b/db/migrate/20190226102954_add_start_and_end_destination_to_lesson.rb
index 7649657ad..0a2cf2f81 100644
--- a/db/migrate/20190226102954_add_start_and_end_destination_to_lesson.rb
+++ b/db/migrate/20190226102954_add_start_and_end_destination_to_lesson.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddStartAndEndDestinationToLesson < ActiveRecord::Migration[5.2]
def change
add_column :lessons, :start_destination, :text
add_column :lessons, :end_destination, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190227130143_add_hidden_to_chapter.rb b/db/migrate/20190227130143_add_hidden_to_chapter.rb
index 9b9bd5e34..8eb9d94f1 100644
--- a/db/migrate/20190227130143_add_hidden_to_chapter.rb
+++ b/db/migrate/20190227130143_add_hidden_to_chapter.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddHiddenToChapter < ActiveRecord::Migration[5.2]
def change
add_column :chapters, :hidden, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190227142829_add_hidden_to_section.rb b/db/migrate/20190227142829_add_hidden_to_section.rb
index 8fb79365a..4f5f8aaba 100644
--- a/db/migrate/20190227142829_add_hidden_to_section.rb
+++ b/db/migrate/20190227142829_add_hidden_to_section.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddHiddenToSection < ActiveRecord::Migration[5.2]
def change
add_column :sections, :hidden, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190227173517_add_hidden_to_item.rb b/db/migrate/20190227173517_add_hidden_to_item.rb
index b7a8ec768..b0cbef60e 100644
--- a/db/migrate/20190227173517_add_hidden_to_item.rb
+++ b/db/migrate/20190227173517_add_hidden_to_item.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddHiddenToItem < ActiveRecord::Migration[5.2]
def change
add_column :items, :hidden, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190301121741_add_imported_manuscript_to_medium.rb b/db/migrate/20190301121741_add_imported_manuscript_to_medium.rb
index a47d86cf7..36a2e5c93 100644
--- a/db/migrate/20190301121741_add_imported_manuscript_to_medium.rb
+++ b/db/migrate/20190301121741_add_imported_manuscript_to_medium.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddImportedManuscriptToMedium < ActiveRecord::Migration[5.2]
def change
add_column :media, :imported_manuscript, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190304115617_remove_tags_from_scripts.rb b/db/migrate/20190304115617_remove_tags_from_scripts.rb
index f9ac6f23c..13ba3affd 100644
--- a/db/migrate/20190304115617_remove_tags_from_scripts.rb
+++ b/db/migrate/20190304115617_remove_tags_from_scripts.rb
@@ -1,7 +1,9 @@
+# rubocop:disable Rails/
class RemoveTagsFromScripts < ActiveRecord::Migration[5.2]
def change
- Medium.where(sort: 'Script').each do |m|
+ Medium.where(sort: "Script").each do |m|
m.update(tags: [])
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190323142434_create_answers.rb b/db/migrate/20190323142434_create_answers.rb
index de218be75..68ced36d3 100644
--- a/db/migrate/20190323142434_create_answers.rb
+++ b/db/migrate/20190323142434_create_answers.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateAnswers < ActiveRecord::Migration[5.2]
def change
create_table :answers do |t|
@@ -9,3 +10,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190401132545_drop_questions_remarks_quizzes_tables.rb b/db/migrate/20190401132545_drop_questions_remarks_quizzes_tables.rb
index 4995b2324..d14e8a529 100644
--- a/db/migrate/20190401132545_drop_questions_remarks_quizzes_tables.rb
+++ b/db/migrate/20190401132545_drop_questions_remarks_quizzes_tables.rb
@@ -9,6 +9,6 @@ def up
end
def down
- fail ActiveRecord::IrreversibleMigration
+ raise ActiveRecord::IrreversibleMigration
end
end
diff --git a/db/migrate/20190401132839_add_quizzable_data_and_type_to_medium.rb b/db/migrate/20190401132839_add_quizzable_data_and_type_to_medium.rb
index f87dacb51..9e3fe3e14 100644
--- a/db/migrate/20190401132839_add_quizzable_data_and_type_to_medium.rb
+++ b/db/migrate/20190401132839_add_quizzable_data_and_type_to_medium.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddQuizzableDataAndTypeToMedium < ActiveRecord::Migration[5.2]
def change
add_column :media, :hint, :text
@@ -7,3 +8,4 @@ def change
add_column :media, :type, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190404132603_add_independent_to_medium.rb b/db/migrate/20190404132603_add_independent_to_medium.rb
index 3f5d9d5e9..c650eb8aa 100644
--- a/db/migrate/20190404132603_add_independent_to_medium.rb
+++ b/db/migrate/20190404132603_add_independent_to_medium.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddIndependentToMedium < ActiveRecord::Migration[5.2]
def change
add_column :media, :independent, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190405110252_add_organizational_data_to_course.rb b/db/migrate/20190405110252_add_organizational_data_to_course.rb
index 62d57e165..efcc3b32d 100644
--- a/db/migrate/20190405110252_add_organizational_data_to_course.rb
+++ b/db/migrate/20190405110252_add_organizational_data_to_course.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddOrganizationalDataToCourse < ActiveRecord::Migration[5.2]
def change
add_column :courses, :organizational, :boolean
add_column :courses, :organizational_concept, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190418081446_rename_keks_question_remark_quiz.rb b/db/migrate/20190418081446_rename_keks_question_remark_quiz.rb
index 3b8614956..54931a115 100644
--- a/db/migrate/20190418081446_rename_keks_question_remark_quiz.rb
+++ b/db/migrate/20190418081446_rename_keks_question_remark_quiz.rb
@@ -1,13 +1,15 @@
+# rubocop:disable Rails/
class RenameKeksQuestionRemarkQuiz < ActiveRecord::Migration[5.2]
def up
- Medium.where(sort: 'KeksQuestion').update_all(sort: 'Question')
- Medium.where(sort: 'KeksRemark').update_all(sort: 'Remark')
- Medium.where(sort: 'KeksQuiz').update_all(sort: 'Quiz')
+ Medium.where(sort: "KeksQuestion").update_all(sort: "Question")
+ Medium.where(sort: "KeksRemark").update_all(sort: "Remark")
+ Medium.where(sort: "KeksQuiz").update_all(sort: "Quiz")
end
def down
- Medium.where(sort: 'Question').update_all(sort: 'KeksQuestion')
- Medium.where(sort: 'Remark').update_all(sort: 'KeksRemark')
- Medium.where(sort: 'Quiz').update_all(sort: 'KeksQuiz')
+ Medium.where(sort: "Question").update_all(sort: "KeksQuestion")
+ Medium.where(sort: "Remark").update_all(sort: "KeksRemark")
+ Medium.where(sort: "Quiz").update_all(sort: "KeksQuiz")
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190424174546_update_tag_orders.rb b/db/migrate/20190424174546_update_tag_orders.rb
index e0406b793..bab2fc5af 100644
--- a/db/migrate/20190424174546_update_tag_orders.rb
+++ b/db/migrate/20190424174546_update_tag_orders.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class UpdateTagOrders < ActiveRecord::Migration[5.2]
def change
Section.all.each do |s|
@@ -5,3 +6,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190430111047_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb b/db/migrate/20190430111047_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb
index ff5d72c7e..1b0a8f9f1 100644
--- a/db/migrate/20190430111047_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb
+++ b/db/migrate/20190430111047_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.active_storage.rb
@@ -3,8 +3,8 @@ class AddForeignKeyConstraintToActiveStorageAttachmentsForBlobId < ActiveRecord:
def up
return if foreign_key_exists?(:active_storage_attachments, column: :blob_id)
- if table_exists?(:active_storage_blobs)
- add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
- end
+ return unless table_exists?(:active_storage_blobs)
+
+ add_foreign_key :active_storage_attachments, :active_storage_blobs, column: :blob_id
end
end
diff --git a/db/migrate/20190501135008_remove_news_from_course.rb b/db/migrate/20190501135008_remove_news_from_course.rb
index 6a534b715..61f4e2df1 100644
--- a/db/migrate/20190501135008_remove_news_from_course.rb
+++ b/db/migrate/20190501135008_remove_news_from_course.rb
@@ -1,6 +1,5 @@
class RemoveNewsFromCourse < ActiveRecord::Migration[6.0]
def change
-
remove_column :courses, :news, :text
end
end
diff --git a/db/migrate/20190501135301_remove_number_from_item.rb b/db/migrate/20190501135301_remove_number_from_item.rb
index 32c3a1e19..112a16f8a 100644
--- a/db/migrate/20190501135301_remove_number_from_item.rb
+++ b/db/migrate/20190501135301_remove_number_from_item.rb
@@ -1,6 +1,5 @@
class RemoveNumberFromItem < ActiveRecord::Migration[6.0]
def change
-
remove_column :items, :number, :integer
end
end
diff --git a/db/migrate/20190501135815_remove_colums_from_medium.rb b/db/migrate/20190501135815_remove_colums_from_medium.rb
index e8d2713d0..8e6f5067f 100644
--- a/db/migrate/20190501135815_remove_colums_from_medium.rb
+++ b/db/migrate/20190501135815_remove_colums_from_medium.rb
@@ -1,6 +1,6 @@
+# rubocop:disable Rails/
class RemoveColumsFromMedium < ActiveRecord::Migration[6.0]
def change
-
remove_column :media, :video_file_link, :text
remove_column :media, :video_stream_link, :text
@@ -14,3 +14,4 @@ def change
remove_column :media, :extras_description, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190507171538_add_default_locale_to_course.rb b/db/migrate/20190507171538_add_default_locale_to_course.rb
index 5841e3995..6b94c57a5 100644
--- a/db/migrate/20190507171538_add_default_locale_to_course.rb
+++ b/db/migrate/20190507171538_add_default_locale_to_course.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddDefaultLocaleToCourse < ActiveRecord::Migration[6.0]
def change
Course.update_all(locale: I18n.default_locale.to_s)
@@ -5,3 +6,4 @@ def change
User.update_all(locale: I18n.default_locale.to_s)
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190508130822_create_notions.rb b/db/migrate/20190508130822_create_notions.rb
index fc5547338..b42782239 100644
--- a/db/migrate/20190508130822_create_notions.rb
+++ b/db/migrate/20190508130822_create_notions.rb
@@ -1,8 +1,9 @@
+# rubocop:disable Style/SymbolProc
class CreateNotions < ActiveRecord::Migration[6.0]
def change
create_table :notions do |t|
-
t.timestamps
end
end
end
+# rubocop:enable Style/SymbolProc
diff --git a/db/migrate/20190508131506_add_columns_to_notion.rb b/db/migrate/20190508131506_add_columns_to_notion.rb
index fbafd5c0d..3b3b5efd1 100644
--- a/db/migrate/20190508131506_add_columns_to_notion.rb
+++ b/db/migrate/20190508131506_add_columns_to_notion.rb
@@ -1,6 +1,8 @@
+# rubocop:disable Rails/
class AddColumnsToNotion < ActiveRecord::Migration[6.0]
def change
add_column :notions, :title, :text
add_column :notions, :locale, :text
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190508140309_add_aliased_tag_to_notion.rb b/db/migrate/20190508140309_add_aliased_tag_to_notion.rb
index a55ace1a9..b71c09af7 100644
--- a/db/migrate/20190508140309_add_aliased_tag_to_notion.rb
+++ b/db/migrate/20190508140309_add_aliased_tag_to_notion.rb
@@ -3,6 +3,7 @@ def up
add_column :notions, :aliased_tag_id, :integer
add_index :notions, :aliased_tag_id
end
+
def down
remove_column :notions, :aliased_tag_id
remove_index :notions, :aliased_tag_id
diff --git a/db/migrate/20190511031012_generate_notions_from_tag_titles.rb b/db/migrate/20190511031012_generate_notions_from_tag_titles.rb
index 92251f414..475078181 100644
--- a/db/migrate/20190511031012_generate_notions_from_tag_titles.rb
+++ b/db/migrate/20190511031012_generate_notions_from_tag_titles.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class GenerateNotionsFromTagTitles < ActiveRecord::Migration[6.0]
def change
Tag.all.each do |t|
@@ -7,3 +8,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190518161033_add_email_notifications_to_user.rb b/db/migrate/20190518161033_add_email_notifications_to_user.rb
index 543c3a133..0f67c4f3b 100644
--- a/db/migrate/20190518161033_add_email_notifications_to_user.rb
+++ b/db/migrate/20190518161033_add_email_notifications_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddEmailNotificationsToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :email_notifications, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190522110318_add_mail_properties_to_user.rb b/db/migrate/20190522110318_add_mail_properties_to_user.rb
index 26c009725..81cfdebd8 100644
--- a/db/migrate/20190522110318_add_mail_properties_to_user.rb
+++ b/db/migrate/20190522110318_add_mail_properties_to_user.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddMailPropertiesToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :email_for_medium, :boolean
@@ -6,3 +7,4 @@ def change
add_column :users, :email_for_news, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190522114150_remove_email_notifications_from_user.rb b/db/migrate/20190522114150_remove_email_notifications_from_user.rb
index 0e8ee74f3..845b4aaca 100644
--- a/db/migrate/20190522114150_remove_email_notifications_from_user.rb
+++ b/db/migrate/20190522114150_remove_email_notifications_from_user.rb
@@ -1,6 +1,5 @@
class RemoveEmailNotificationsFromUser < ActiveRecord::Migration[6.0]
def change
-
remove_column :users, :email_notifications, :boolean
end
end
diff --git a/db/migrate/20190611081201_remove_title_backup_from_tag.rb b/db/migrate/20190611081201_remove_title_backup_from_tag.rb
index 6bbec0ebb..e26ec4a5a 100644
--- a/db/migrate/20190611081201_remove_title_backup_from_tag.rb
+++ b/db/migrate/20190611081201_remove_title_backup_from_tag.rb
@@ -1,6 +1,5 @@
class RemoveTitleBackupFromTag < ActiveRecord::Migration[6.0]
def change
-
remove_column :tags, :title_backup, :string
end
end
diff --git a/db/migrate/20190808083830_add_open_to_clicker.rb b/db/migrate/20190808083830_add_open_to_clicker.rb
index f0b1973d1..196352b41 100644
--- a/db/migrate/20190808083830_add_open_to_clicker.rb
+++ b/db/migrate/20190808083830_add_open_to_clicker.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddOpenToClicker < ActiveRecord::Migration[6.0]
def change
add_column :clickers, :open, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20190817163159_add_confirmable_to_devise_again.rb b/db/migrate/20190817163159_add_confirmable_to_devise_again.rb
index 286cc2854..8a46470e1 100644
--- a/db/migrate/20190817163159_add_confirmable_to_devise_again.rb
+++ b/db/migrate/20190817163159_add_confirmable_to_devise_again.rb
@@ -1,5 +1,6 @@
+# rubocop:disable Rails/
class AddConfirmableToDeviseAgain < ActiveRecord::Migration[6.0]
- # Note: You can't use change, as User.update_all will fail in the down migration
+ # NOTE: You can't use change, as User.update_all will fail in the down migration
def up
add_column :users, :confirmation_token, :string
add_column :users, :confirmed_at, :datetime
@@ -17,3 +18,4 @@ def down
remove_columns :users, :unconfirmed_email # Only if using reconfirmable
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200320124731_add_translation_table_to_program.rb b/db/migrate/20200320124731_add_translation_table_to_program.rb
index fcd4f95ea..dbeab5fa1 100644
--- a/db/migrate/20200320124731_add_translation_table_to_program.rb
+++ b/db/migrate/20200320124731_add_translation_table_to_program.rb
@@ -1,10 +1,11 @@
class AddTranslationTableToProgram < ActiveRecord::Migration[6.0]
def self.up
Program.create_translation_table!({
- name: :text }, {
- migrate_data: true,
- remove_source_columns: true
- })
+ name: :text
+ }, {
+ migrate_data: true,
+ remove_source_columns: true
+ })
end
def self.down
diff --git a/db/migrate/20200320124830_add_translation_table_to_subject.rb b/db/migrate/20200320124830_add_translation_table_to_subject.rb
index d4e34bd28..601201e52 100644
--- a/db/migrate/20200320124830_add_translation_table_to_subject.rb
+++ b/db/migrate/20200320124830_add_translation_table_to_subject.rb
@@ -1,10 +1,11 @@
class AddTranslationTableToSubject < ActiveRecord::Migration[6.0]
def self.up
Subject.create_translation_table!({
- name: :text }, {
- migrate_data: true,
- remove_source_columns: true
- })
+ name: :text
+ }, {
+ migrate_data: true,
+ remove_source_columns: true
+ })
end
def self.down
diff --git a/db/migrate/20200322130432_add_translation_table_to_division.rb b/db/migrate/20200322130432_add_translation_table_to_division.rb
index b7dd170a9..f5476eb17 100644
--- a/db/migrate/20200322130432_add_translation_table_to_division.rb
+++ b/db/migrate/20200322130432_add_translation_table_to_division.rb
@@ -1,10 +1,11 @@
class AddTranslationTableToDivision < ActiveRecord::Migration[6.0]
def self.up
Division.create_translation_table!({
- name: :text }, {
- migrate_data: true,
- remove_source_columns: true
- })
+ name: :text
+ }, {
+ migrate_data: true,
+ remove_source_columns: true
+ })
end
def self.down
diff --git a/db/migrate/20200410111827_install_commontator.commontator.rb b/db/migrate/20200410111827_install_commontator.commontator.rb
index f4b267bbb..d05a24ecd 100644
--- a/db/migrate/20200410111827_install_commontator.commontator.rb
+++ b/db/migrate/20200410111827_install_commontator.commontator.rb
@@ -4,7 +4,7 @@ def change
create_table :commontator_threads do |t|
t.references :commontable,
polymorphic: true,
- index: { unique: true, name: 'index_commontator_threads_on_c_id_and_c_type' }
+ index: { unique: true, name: "index_commontator_threads_on_c_id_and_c_type" }
t.references :closer, polymorphic: true
t.datetime :closed_at
@@ -28,9 +28,9 @@ def change
t.timestamps
end
- add_index :commontator_comments, [ :creator_id, :creator_type, :thread_id ],
- name: 'index_commontator_comments_on_c_id_and_c_type_and_t_id'
- add_index :commontator_comments, [ :thread_id, :created_at ]
+ add_index :commontator_comments, [:creator_id, :creator_type, :thread_id],
+ name: "index_commontator_comments_on_c_id_and_c_type_and_t_id"
+ add_index :commontator_comments, [:thread_id, :created_at]
create_table :commontator_subscriptions do |t|
t.references :thread, null: false, foreign_key: {
@@ -41,8 +41,8 @@ def change
t.timestamps
end
- add_index :commontator_subscriptions, [ :subscriber_id, :subscriber_type, :thread_id ],
+ add_index :commontator_subscriptions, [:subscriber_id, :subscriber_type, :thread_id],
unique: true,
- name: 'index_commontator_subscriptions_on_s_id_and_s_type_and_t_id'
+ name: "index_commontator_subscriptions_on_s_id_and_s_type_and_t_id"
end
end
diff --git a/db/migrate/20200412104751_acts_as_votable_migration.rb b/db/migrate/20200412104751_acts_as_votable_migration.rb
index ebea6e772..e09f1c178 100644
--- a/db/migrate/20200412104751_acts_as_votable_migration.rb
+++ b/db/migrate/20200412104751_acts_as_votable_migration.rb
@@ -1,9 +1,9 @@
+# rubocop:disable Rails/
class ActsAsVotableMigration < ActiveRecord::Migration[6.0]
def self.up
create_table :votes do |t|
-
- t.references :votable, :polymorphic => true
- t.references :voter, :polymorphic => true
+ t.references :votable, polymorphic: true
+ t.references :voter, polymorphic: true
t.boolean :vote_flag
t.string :vote_scope
@@ -20,3 +20,4 @@ def self.down
drop_table :votes
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200414170119_add_unread_comments_to_user.rb b/db/migrate/20200414170119_add_unread_comments_to_user.rb
index e856c0d37..d268ba4d0 100644
--- a/db/migrate/20200414170119_add_unread_comments_to_user.rb
+++ b/db/migrate/20200414170119_add_unread_comments_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddUnreadCommentsToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :unread_comments, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200509111503_remove_fk_on_course_division_join.rb b/db/migrate/20200509111503_remove_fk_on_course_division_join.rb
index 24605dc9a..99564606e 100644
--- a/db/migrate/20200509111503_remove_fk_on_course_division_join.rb
+++ b/db/migrate/20200509111503_remove_fk_on_course_division_join.rb
@@ -3,8 +3,8 @@ def change
if foreign_key_exists?(:division_course_joins, :divisions)
remove_foreign_key :division_course_joins, :divisions
end
- if foreign_key_exists?(:division_course_joins, :courses)
- remove_foreign_key :division_course_joins, :courses
- end
+ return unless foreign_key_exists?(:division_course_joins, :courses)
+
+ remove_foreign_key :division_course_joins, :courses
end
end
diff --git a/db/migrate/20200510062602_remove_fk_on_course_self_join.rb b/db/migrate/20200510062602_remove_fk_on_course_self_join.rb
index 07983d743..674f0344a 100644
--- a/db/migrate/20200510062602_remove_fk_on_course_self_join.rb
+++ b/db/migrate/20200510062602_remove_fk_on_course_self_join.rb
@@ -1,7 +1,7 @@
class RemoveFkOnCourseSelfJoin < ActiveRecord::Migration[6.0]
def change
- if foreign_key_exists?(:course_self_joins, :courses)
- remove_foreign_key :course_self_joins, :courses
- end
+ return unless foreign_key_exists?(:course_self_joins, :courses)
+
+ remove_foreign_key :course_self_joins, :courses
end
end
diff --git a/db/migrate/20200510104347_create_item_self_join.rb b/db/migrate/20200510104347_create_item_self_join.rb
index c9f9e2900..ba3932bec 100644
--- a/db/migrate/20200510104347_create_item_self_join.rb
+++ b/db/migrate/20200510104347_create_item_self_join.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateItemSelfJoin < ActiveRecord::Migration[6.0]
def change
create_table :item_self_joins do |t|
@@ -6,3 +7,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200521120400_add_position_to_section_tag_join.rb b/db/migrate/20200521120400_add_position_to_section_tag_join.rb
index 38a15de2e..fd99cb583 100644
--- a/db/migrate/20200521120400_add_position_to_section_tag_join.rb
+++ b/db/migrate/20200521120400_add_position_to_section_tag_join.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddPositionToSectionTagJoin < ActiveRecord::Migration[6.0]
def change
add_column :section_tag_joins, :tag_position, :integer
@@ -6,3 +7,4 @@ def change
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200521152416_fill_position_values_for_media.rb b/db/migrate/20200521152416_fill_position_values_for_media.rb
index 55d2b11ad..6367f7ae7 100644
--- a/db/migrate/20200521152416_fill_position_values_for_media.rb
+++ b/db/migrate/20200521152416_fill_position_values_for_media.rb
@@ -1,19 +1,21 @@
+# rubocop:disable Rails/
class FillPositionValuesForMedia < ActiveRecord::Migration[6.0]
def change
- Course.all.each do |course|
- course.media.order(:id).each_with_index do |medium, index|
- medium.update_column :position, index
- end
+ Course.all.each do |course|
+ course.media.order(:id).each_with_index do |medium, index|
+ medium.update_column :position, index
+ end
end
- Lecture.all.each do |lecture|
- lecture.media.order(:id).each_with_index do |medium, index|
- medium.update_column :position, index
- end
+ Lecture.all.each do |lecture|
+ lecture.media.order(:id).each_with_index do |medium, index|
+ medium.update_column :position, index
+ end
end
- Lesson.all.each do |lesson|
- lesson.media.order(:id).each_with_index do |medium, index|
- medium.update_column :position, index
- end
+ Lesson.all.each do |lesson|
+ lesson.media.order(:id).each_with_index do |medium, index|
+ medium.update_column :position, index
+ end
end
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200531141619_add_comments_disabled_to_lecture.rb b/db/migrate/20200531141619_add_comments_disabled_to_lecture.rb
index d29a334cc..d3a11090e 100644
--- a/db/migrate/20200531141619_add_comments_disabled_to_lecture.rb
+++ b/db/migrate/20200531141619_add_comments_disabled_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddCommentsDisabledToLecture < ActiveRecord::Migration[6.0]
def change
add_column :lectures, :comments_disabled, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200606133607_add_active_to_term.rb b/db/migrate/20200606133607_add_active_to_term.rb
index 78ff87b33..77224c709 100644
--- a/db/migrate/20200606133607_add_active_to_term.rb
+++ b/db/migrate/20200606133607_add_active_to_term.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddActiveToTerm < ActiveRecord::Migration[6.0]
def change
add_column :terms, :active, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200611130229_add_study_participant_to_user.rb b/db/migrate/20200611130229_add_study_participant_to_user.rb
index da824a82b..b3b93bc2a 100644
--- a/db/migrate/20200611130229_add_study_participant_to_user.rb
+++ b/db/migrate/20200611130229_add_study_participant_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddStudyParticipantToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :study_participant, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200613090342_add_text_input_to_medium.rb b/db/migrate/20200613090342_add_text_input_to_medium.rb
index e8af181d6..e09b5c751 100644
--- a/db/migrate/20200613090342_add_text_input_to_medium.rb
+++ b/db/migrate/20200613090342_add_text_input_to_medium.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddTextInputToMedium < ActiveRecord::Migration[6.0]
def change
add_column :media, :text_input, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200809123000_add_new_design_to_user.rb b/db/migrate/20200809123000_add_new_design_to_user.rb
index 576eb3f9b..7e5a223cd 100644
--- a/db/migrate/20200809123000_add_new_design_to_user.rb
+++ b/db/migrate/20200809123000_add_new_design_to_user.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddNewDesignToUser < ActiveRecord::Migration[6.0]
def change
add_column :users, :new_design, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200810162008_add_term_independent_to_course.rb b/db/migrate/20200810162008_add_term_independent_to_course.rb
index d73558e9f..655a06a72 100644
--- a/db/migrate/20200810162008_add_term_independent_to_course.rb
+++ b/db/migrate/20200810162008_add_term_independent_to_course.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddTermIndependentToCourse < ActiveRecord::Migration[6.0]
def change
add_column :courses, :term_independent, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200903152249_add_organizational_on_top_to_lecture.rb b/db/migrate/20200903152249_add_organizational_on_top_to_lecture.rb
index 8afcba323..c73b04279 100644
--- a/db/migrate/20200903152249_add_organizational_on_top_to_lecture.rb
+++ b/db/migrate/20200903152249_add_organizational_on_top_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddOrganizationalOnTopToLecture < ActiveRecord::Migration[6.0]
def change
add_column :lectures, :organizational_on_top, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200907113337_add_disable_teacher_display_to_lecture.rb b/db/migrate/20200907113337_add_disable_teacher_display_to_lecture.rb
index 0b7d26c35..10b2eddad 100644
--- a/db/migrate/20200907113337_add_disable_teacher_display_to_lecture.rb
+++ b/db/migrate/20200907113337_add_disable_teacher_display_to_lecture.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddDisableTeacherDisplayToLecture < ActiveRecord::Migration[6.0]
def change
add_column :lectures, :disable_teacher_display, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200926155041_add_invited_user_ids_to_submission.rb b/db/migrate/20200926155041_add_invited_user_ids_to_submission.rb
index 5a2f750b1..30d3cd59d 100644
--- a/db/migrate/20200926155041_add_invited_user_ids_to_submission.rb
+++ b/db/migrate/20200926155041_add_invited_user_ids_to_submission.rb
@@ -1,10 +1,10 @@
class AddInvitedUserIdsToSubmission < ActiveRecord::Migration[6.0]
def up
- add_column :submissions, :invited_user_ids, :integer, array: true,
- default: []
+ add_column :submissions, :invited_user_ids, :integer, array: true,
+ default: []
end
def down
- remove_column :submissions, :invited_user_ids
+ remove_column :submissions, :invited_user_ids
end
end
diff --git a/db/migrate/20200927111435_add_submission_email_flags_to_user.rb b/db/migrate/20200927111435_add_submission_email_flags_to_user.rb
index cf4818cf6..6f58d99fd 100644
--- a/db/migrate/20200927111435_add_submission_email_flags_to_user.rb
+++ b/db/migrate/20200927111435_add_submission_email_flags_to_user.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddSubmissionEmailFlagsToUser < ActiveRecord::Migration[6.0]
def up
add_column :users, :email_for_submission_upload, :boolean
@@ -13,3 +14,4 @@ def down
remove_column :users, :email_for_submission_leave, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20200927134606_add_submission_max_team_size_to_lecture.rb b/db/migrate/20200927134606_add_submission_max_team_size_to_lecture.rb
index a4032997f..e7b9a755b 100644
--- a/db/migrate/20200927134606_add_submission_max_team_size_to_lecture.rb
+++ b/db/migrate/20200927134606_add_submission_max_team_size_to_lecture.rb
@@ -4,6 +4,6 @@ def up
end
def down
- remove_column :lectures, :submission_max_team_size, :integer
+ remove_column :lectures, :submission_max_team_size, :integer
end
end
diff --git a/db/migrate/20201002091503_enable_uuid_extension.rb b/db/migrate/20201002091503_enable_uuid_extension.rb
index 5a22dedfb..19b328a57 100644
--- a/db/migrate/20201002091503_enable_uuid_extension.rb
+++ b/db/migrate/20201002091503_enable_uuid_extension.rb
@@ -1,5 +1,5 @@
class EnableUuidExtension < ActiveRecord::Migration[6.0]
def change
- enable_extension 'pgcrypto'
+ enable_extension "pgcrypto"
end
end
diff --git a/db/migrate/20201002092028_add_uuid_to_submissions.rb b/db/migrate/20201002092028_add_uuid_to_submissions.rb
index 67bcae4a0..26d44f964 100644
--- a/db/migrate/20201002092028_add_uuid_to_submissions.rb
+++ b/db/migrate/20201002092028_add_uuid_to_submissions.rb
@@ -1,6 +1,6 @@
class AddUuidToSubmissions < ActiveRecord::Migration[6.0]
def change
add_column :submissions, :uuid, :uuid, default: "gen_random_uuid()",
- null: false
+ null: false
end
end
diff --git a/db/migrate/20201002094500_change_submission_foreign_keys.rb b/db/migrate/20201002094500_change_submission_foreign_keys.rb
index 6513fce52..f8c2c3d59 100644
--- a/db/migrate/20201002094500_change_submission_foreign_keys.rb
+++ b/db/migrate/20201002094500_change_submission_foreign_keys.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class ChangeSubmissionForeignKeys < ActiveRecord::Migration[6.0]
def up
remove_index :user_submission_joins,
@@ -20,12 +21,15 @@ def id_to_uuid(table_name, relation_name, relation_class)
add_column table_name, new_foreign_key, :uuid
klass.where.not(foreign_key => nil).each do |record|
- if associated_record = relation_klass.find_by(id: record.send(foreign_key))
- record.update_column(new_foreign_key, associated_record.uuid)
- end
+ # rubocop:disable Lint/AssignmentInCondition
+ next unless associated_record = relation_klass.find_by(id: record.send(foreign_key))
+ # rubocop:enable Lint/AssignmentInCondition
+
+ record.update_column(new_foreign_key, associated_record.uuid)
end
remove_column table_name, foreign_key
rename_column table_name, new_foreign_key, foreign_key
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201002095520_set_submission_primary_key_to_uuid.rb b/db/migrate/20201002095520_set_submission_primary_key_to_uuid.rb
index 8537fb04e..24f508e2d 100644
--- a/db/migrate/20201002095520_set_submission_primary_key_to_uuid.rb
+++ b/db/migrate/20201002095520_set_submission_primary_key_to_uuid.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class SetSubmissionPrimaryKeyToUuid < ActiveRecord::Migration[6.0]
def up
rename_column :submissions, :id, :integer_id
@@ -10,3 +11,4 @@ def down
raise ActiveRecord::IrreversibleMigration
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201004141237_add_correction_email_to_user.rb b/db/migrate/20201004141237_add_correction_email_to_user.rb
index e69ee479d..c61a28f82 100644
--- a/db/migrate/20201004141237_add_correction_email_to_user.rb
+++ b/db/migrate/20201004141237_add_correction_email_to_user.rb
@@ -1,9 +1,11 @@
+# rubocop:disable Rails/
class AddCorrectionEmailToUser < ActiveRecord::Migration[6.0]
def up
add_column :users, :email_for_correction_upload, :boolean
end
def down
- remove_column :users, :email_for_correction_upload, :boolean
+ remove_column :users, :email_for_correction_upload, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201008135825_add_accepted_to_submission.rb b/db/migrate/20201008135825_add_accepted_to_submission.rb
index 686094194..ed8b05d32 100644
--- a/db/migrate/20201008135825_add_accepted_to_submission.rb
+++ b/db/migrate/20201008135825_add_accepted_to_submission.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddAcceptedToSubmission < ActiveRecord::Migration[6.0]
def up
add_column :submissions, :accepted, :boolean
@@ -7,3 +8,4 @@ def down
remove_column :submissions, :accepted, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201009154917_add_email_for_submission_decisions_to_user.rb b/db/migrate/20201009154917_add_email_for_submission_decisions_to_user.rb
index 148c5c6b8..fa3be5d95 100644
--- a/db/migrate/20201009154917_add_email_for_submission_decisions_to_user.rb
+++ b/db/migrate/20201009154917_add_email_for_submission_decisions_to_user.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddEmailForSubmissionDecisionsToUser < ActiveRecord::Migration[6.0]
def up
add_column :users, :email_for_submission_decision, :boolean
@@ -7,3 +8,4 @@ def down
remove_column :users, :email_for_submission_decision, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201015154231_add_archived_to_user.rb b/db/migrate/20201015154231_add_archived_to_user.rb
index 60a77c71a..8e0877e6c 100644
--- a/db/migrate/20201015154231_add_archived_to_user.rb
+++ b/db/migrate/20201015154231_add_archived_to_user.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddArchivedToUser < ActiveRecord::Migration[6.0]
def up
add_column :users, :archived, :boolean
@@ -7,3 +8,4 @@ def down
remove_column :users, :archived, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201017133345_create_tutor_tutorial_joins.rb b/db/migrate/20201017133345_create_tutor_tutorial_joins.rb
index 1bacb911b..b2fdd3287 100644
--- a/db/migrate/20201017133345_create_tutor_tutorial_joins.rb
+++ b/db/migrate/20201017133345_create_tutor_tutorial_joins.rb
@@ -9,6 +9,6 @@ def up
end
def down
- drop_table :tutor_tutorial_joins
+ drop_table :tutor_tutorial_joins
end
end
diff --git a/db/migrate/20201022163956_add_accepted_file_type_to_assignment.rb b/db/migrate/20201022163956_add_accepted_file_type_to_assignment.rb
index 7766f8411..3d76b19dc 100644
--- a/db/migrate/20201022163956_add_accepted_file_type_to_assignment.rb
+++ b/db/migrate/20201022163956_add_accepted_file_type_to_assignment.rb
@@ -1,6 +1,6 @@
class AddAcceptedFileTypeToAssignment < ActiveRecord::Migration[6.0]
def up
- add_column :assignments, :accepted_file_type, :text, default: '.pdf'
+ add_column :assignments, :accepted_file_type, :text, default: ".pdf"
end
def down
diff --git a/db/migrate/20201026151550_remove_redundant_columns_for_v13.rb b/db/migrate/20201026151550_remove_redundant_columns_for_v13.rb
index 7e9260e1f..b2674bc10 100644
--- a/db/migrate/20201026151550_remove_redundant_columns_for_v13.rb
+++ b/db/migrate/20201026151550_remove_redundant_columns_for_v13.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class RemoveRedundantColumnsForV13 < ActiveRecord::Migration[6.0]
def up
remove_column :users, :edited_profile, :boolean
@@ -9,3 +10,4 @@ def down
add_column :tutorial, :tutor_id, :integer
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201114125010_add_boost_to_medium.rb b/db/migrate/20201114125010_add_boost_to_medium.rb
index 8ad13bba0..18e3ef526 100644
--- a/db/migrate/20201114125010_add_boost_to_medium.rb
+++ b/db/migrate/20201114125010_add_boost_to_medium.rb
@@ -4,6 +4,6 @@ def up
end
def down
- remove_column :media, :boost, :float
+ remove_column :media, :boost, :float
end
end
diff --git a/db/migrate/20201121151659_add_on_main_page_to_announcement.rb b/db/migrate/20201121151659_add_on_main_page_to_announcement.rb
index 762fc3bbf..d2bfc2e26 100644
--- a/db/migrate/20201121151659_add_on_main_page_to_announcement.rb
+++ b/db/migrate/20201121151659_add_on_main_page_to_announcement.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddOnMainPageToAnnouncement < ActiveRecord::Migration[6.0]
def up
add_column :announcements, :on_main_page, :boolean, default: false
@@ -7,3 +8,4 @@ def down
remove_column :announcements, :on_main_page, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20201124223030_create_user_favorite_lecture_joins.rb b/db/migrate/20201124223030_create_user_favorite_lecture_joins.rb
index 50aaa0c50..57699f8ab 100644
--- a/db/migrate/20201124223030_create_user_favorite_lecture_joins.rb
+++ b/db/migrate/20201124223030_create_user_favorite_lecture_joins.rb
@@ -9,6 +9,6 @@ def up
end
def down
- drop_table :user_favorite_lecture_joins
+ drop_table :user_favorite_lecture_joins
end
end
diff --git a/db/migrate/20210226094753_add_release_infos_to_medium.rb b/db/migrate/20210226094753_add_release_infos_to_medium.rb
index e9b7633bc..21300b630 100644
--- a/db/migrate/20210226094753_add_release_infos_to_medium.rb
+++ b/db/migrate/20210226094753_add_release_infos_to_medium.rb
@@ -1,9 +1,10 @@
+# rubocop:disable Rails/
class AddReleaseInfosToMedium < ActiveRecord::Migration[6.0]
def up
add_column :media, :released_at, :datetime
add_column :media, :release_date, :datetime
- Medium.where(released: ['all', 'users', 'subscribers']).each do |m|
+ Medium.where(released: ["all", "users", "subscribers"]).each do |m|
m.update_columns(released_at: m.created_at)
end
end
@@ -13,3 +14,4 @@ def down
remove_column :media, :release_date, :datetime
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210319102604_add_submission_deletion_columns_to_term.rb b/db/migrate/20210319102604_add_submission_deletion_columns_to_term.rb
index 5927fe801..ce2375feb 100644
--- a/db/migrate/20210319102604_add_submission_deletion_columns_to_term.rb
+++ b/db/migrate/20210319102604_add_submission_deletion_columns_to_term.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddSubmissionDeletionColumnsToTerm < ActiveRecord::Migration[6.0]
def up
add_column :terms, :submission_deletion_mail, :datetime
@@ -11,3 +12,4 @@ def down
remove_column :terms, :submissions_deleted_at, :datetime
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210710122546_create_talks.rb b/db/migrate/20210710122546_create_talks.rb
index 29ede44e5..7a15cb5e2 100644
--- a/db/migrate/20210710122546_create_talks.rb
+++ b/db/migrate/20210710122546_create_talks.rb
@@ -10,4 +10,4 @@ def up
def down
drop_table :talks
end
-end
\ No newline at end of file
+end
diff --git a/db/migrate/20210710130619_add_legacy_seminar_to_lecture.rb b/db/migrate/20210710130619_add_legacy_seminar_to_lecture.rb
index fd4b1f1ac..25d0c2877 100644
--- a/db/migrate/20210710130619_add_legacy_seminar_to_lecture.rb
+++ b/db/migrate/20210710130619_add_legacy_seminar_to_lecture.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddLegacySeminarToLecture < ActiveRecord::Migration[6.1]
def up
add_column :lectures, :legacy_seminar, :boolean, default: false
@@ -8,3 +9,4 @@ def down
remove_column :lectures, :legacy_seminar, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210710152036_add_title_and_position_to_talk.rb b/db/migrate/20210710152036_add_title_and_position_to_talk.rb
index 6ce7e4b10..732e9bb38 100644
--- a/db/migrate/20210710152036_add_title_and_position_to_talk.rb
+++ b/db/migrate/20210710152036_add_title_and_position_to_talk.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddTitleAndPositionToTalk < ActiveRecord::Migration[6.1]
def up
add_column :talks, :title, :text
@@ -9,3 +10,4 @@ def down
remove_column :talks, :position, :integer
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210827141317_create_watchlist_entries.rb b/db/migrate/20210827141317_create_watchlist_entries.rb
index 7de4da702..edd773ddb 100644
--- a/db/migrate/20210827141317_create_watchlist_entries.rb
+++ b/db/migrate/20210827141317_create_watchlist_entries.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class CreateWatchlistEntries < ActiveRecord::Migration[6.1]
def up
create_table :watchlists
@@ -23,3 +24,4 @@ def down
drop_table :watchlist_entries
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210909153352_add_display_description_to_talk.rb b/db/migrate/20210909153352_add_display_description_to_talk.rb
index d32f7b8d7..c6275c7da 100644
--- a/db/migrate/20210909153352_add_display_description_to_talk.rb
+++ b/db/migrate/20210909153352_add_display_description_to_talk.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddDisplayDescriptionToTalk < ActiveRecord::Migration[6.1]
def up
add_column :talks, :display_description, :boolean, default: false
@@ -7,3 +8,4 @@ def down
remove_column :talks, :display_description, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210923085744_add_protected_to_assignment.rb b/db/migrate/20210923085744_add_protected_to_assignment.rb
index 4cd340f2d..2d781ffde 100644
--- a/db/migrate/20210923085744_add_protected_to_assignment.rb
+++ b/db/migrate/20210923085744_add_protected_to_assignment.rb
@@ -1,5 +1,7 @@
+# rubocop:disable Rails/
class AddProtectedToAssignment < ActiveRecord::Migration[6.1]
def change
- add_column :assignments, :protected, :boolean, :default => false
+ add_column :assignments, :protected, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20210923113111_add_public_to_watchlists.rb b/db/migrate/20210923113111_add_public_to_watchlists.rb
index 9668c108f..a3f16ce64 100644
--- a/db/migrate/20210923113111_add_public_to_watchlists.rb
+++ b/db/migrate/20210923113111_add_public_to_watchlists.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddPublicToWatchlists < ActiveRecord::Migration[6.1]
def up
add_column :watchlists, :public, :boolean, default: false
@@ -7,3 +8,4 @@ def down
remove_column :watchlists, :public, :boolean
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20220125162730_add_deletion_date_to_assignments.rb b/db/migrate/20220125162730_add_deletion_date_to_assignments.rb
index 2da53ebdd..27ca9d27d 100644
--- a/db/migrate/20220125162730_add_deletion_date_to_assignments.rb
+++ b/db/migrate/20220125162730_add_deletion_date_to_assignments.rb
@@ -1,8 +1,10 @@
+# rubocop:disable Rails/
class AddDeletionDateToAssignments < ActiveRecord::Migration[6.1]
def up
+ default_deletion_date = (Term.active&.end_date || (Date.today + 180.days)) + 15.days
add_column :assignments,
:deletion_date,
- :date, null: false, default: (Term.active&.end_date || (Date.today + 180.days)) + 15.days
+ :date, null: false, default: default_deletion_date
remove_column :assignments, :protected, :boolean
end
@@ -11,3 +13,4 @@ def down
add_column :assignments, :protected, :boolean, default: false
end
end
+# rubocop:enable Rails/
diff --git a/db/migrate/20230407093205_change_deletion_date_default_in_assignemnts.rb b/db/migrate/20230407093205_change_deletion_date_default_in_assignemnts.rb
index 6b7287069..9c0173702 100644
--- a/db/migrate/20230407093205_change_deletion_date_default_in_assignemnts.rb
+++ b/db/migrate/20230407093205_change_deletion_date_default_in_assignemnts.rb
@@ -1,6 +1,6 @@
class ChangeDeletionDateDefaultInAssignemnts < ActiveRecord::Migration[7.0]
def change
- change_column_default(:assignments,:deletion_date,
+ change_column_default(:assignments, :deletion_date,
from: "2020-10-15",
to: "2200-01-01")
end
diff --git a/db/migrate/20231101100015_add_devise_trackable_columns_to_users.rb b/db/migrate/20231101100015_add_devise_trackable_columns_to_users.rb
index 94a9eeaf2..b594327e6 100644
--- a/db/migrate/20231101100015_add_devise_trackable_columns_to_users.rb
+++ b/db/migrate/20231101100015_add_devise_trackable_columns_to_users.rb
@@ -1,3 +1,4 @@
+# rubocop:disable Rails/
class AddDeviseTrackableColumnsToUsers < ActiveRecord::Migration[7.0]
def change
add_column :users, :sign_in_count, :integer, default: 0, null: false
@@ -6,4 +7,5 @@ def change
add_column :users, :current_sign_in_ip, :string
add_column :users, :last_sign_in_ip, :string
end
-end
\ No newline at end of file
+end
+# rubocop:enable Rails/
diff --git a/db/seeds.rb b/db/seeds.rb
index 1beea2acc..89f6bb02d 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,5 +1,7 @@
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
+# This file should contain all the record creation needed to seed the database
+# with its default values.
+# The data can then be loaded with the rails db:seed command
+# (or created alongside the database with db:setup).
#
# Examples:
#
diff --git a/lib/collectors/mampf_collector.rb b/lib/collectors/mampf_collector.rb
index 544b9a023..28bfc9d34 100644
--- a/lib/collectors/mampf_collector.rb
+++ b/lib/collectors/mampf_collector.rb
@@ -1,25 +1,28 @@
-unless defined? Rails
- require File.expand_path("../../../config/environment", __FILE__)
-end
+require File.expand_path("../../config/environment", __dir__) unless defined? Rails
class MampfCollector < PrometheusExporter::Server::TypeCollector
- def initialize
- end
-
- def collect(obj)
- end
- def type
- "mampf"
- end
-
- def metrics
- user_count_gauge = PrometheusExporter::Metric::Gauge.new('user_count', 'number of users in the app')
- user_count_gauge.observe User.count
- medium_count_gauge = PrometheusExporter::Metric::Gauge.new('uploaded_medium_count', 'number of media')
- medium_count_gauge.observe Medium.count
- tag_count_gauge = PrometheusExporter::Metric::Gauge.new('tag_count', 'number of tags')
- tag_count_gauge.observe Tag.count
- submissions_count_gauge = PrometheusExporter::Metric::Gauge.new('submissions_count', 'number of submissions')
- submissions_count_gauge.observe Submission.count
- [user_count_gauge, medium_count_gauge,tag_count_gauge, submissions_count_gauge]
- end
- end
\ No newline at end of file
+ def collect(obj)
+ end
+
+ def type
+ "mampf"
+ end
+
+ def metrics
+ user_count_gauge = PrometheusExporter::Metric::Gauge.new("user_count",
+ "number of users in the app")
+ user_count_gauge.observe(User.count)
+
+ medium_count_gauge = PrometheusExporter::Metric::Gauge.new("uploaded_medium_count",
+ "number of media")
+ medium_count_gauge.observe(Medium.count)
+
+ tag_count_gauge = PrometheusExporter::Metric::Gauge.new("tag_count", "number of tags")
+ tag_count_gauge.observe(Tag.count)
+
+ submissions_count_gauge = PrometheusExporter::Metric::Gauge.new("submissions_count",
+ "number of submissions")
+ submissions_count_gauge.observe(Submission.count)
+
+ [user_count_gauge, medium_count_gauge, tag_count_gauge, submissions_count_gauge]
+ end
+end
diff --git a/lib/core_ext/array.rb b/lib/core_ext/array.rb
index edf44afc4..76061b84b 100644
--- a/lib/core_ext/array.rb
+++ b/lib/core_ext/array.rb
@@ -2,7 +2,7 @@ class Array
def percentile(wanted_percentile)
sorted_array = sort
- index = (wanted_percentile.to_f / 100) * sorted_array.length - 1
+ index = ((wanted_percentile.to_f / 100) * sorted_array.length) - 1
if index != index.to_i
sorted_array.at(index.ceil)
@@ -14,4 +14,4 @@ def percentile(wanted_percentile)
sorted_array.at(index)
end
end
-end
\ No newline at end of file
+end
diff --git a/lib/core_ext/enumerable_natural_sort.rb b/lib/core_ext/enumerable_natural_sort.rb
index 9b5f262c3..b7265560f 100644
--- a/lib/core_ext/enumerable_natural_sort.rb
+++ b/lib/core_ext/enumerable_natural_sort.rb
@@ -1,15 +1,13 @@
module Enumerable
-
def natural_sort
natural_sort_by
end
def natural_sort_by(&stringifier)
sort_by do |element|
- element = stringifier.call(element) if stringifier
+ element = yield(element) if stringifier
element = element.to_s unless element.respond_to?(:to_sort_atoms)
element.to_sort_atoms
end
end
-
end
diff --git a/lib/core_ext/integer.rb b/lib/core_ext/integer.rb
index ef701cdf6..f41923d9a 100644
--- a/lib/core_ext/integer.rb
+++ b/lib/core_ext/integer.rb
@@ -1,6 +1,6 @@
# Extensions of Integer class
class Integer
def to_bool_a(size)
- to_s(2).rjust(size, '0').split('').map { |x| x == '1' }
+ to_s(2).rjust(size, "0").chars.map { |x| x == "1" }
end
end
diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb
index c6345e980..41023667b 100644
--- a/lib/core_ext/string.rb
+++ b/lib/core_ext/string.rb
@@ -5,25 +5,26 @@ def string_between_markers(marker1, marker2)
end
def to_h
- array = gsub(/[{}:]/, '').split(', ')
+ array = gsub(/[{}:]/, "").split(", ")
hash = {}
array.each do |e|
- key_string, value_string = e.split('=>')
+ key_string, value_string = e.split("=>")
key = key_string.to_i
- value = value_string == 'true'
+ value = value_string == "true"
hash[key] = value
end
hash
end
def range?
- self.match(/\[-?\d+..-?\d+\]/).present?
+ match(/\[-?\d+..-?\d+\]/).present?
end
def to_a_or_range
- stripped = gsub(/[\[\]]/, '')
- return stripped.split(',') - [''] unless range?
- bounds = stripped.split('..').map(&:to_i)
+ stripped = gsub(/[\[\]]/, "")
+ return stripped.split(",") - [""] unless range?
+
+ bounds = stripped.split("..").map(&:to_i)
(bounds[0]..bounds[1])
end
end
diff --git a/lib/core_ext/string_to_sort_atoms.rb b/lib/core_ext/string_to_sort_atoms.rb
index 0337cbf2b..c61f04850 100644
--- a/lib/core_ext/string_to_sort_atoms.rb
+++ b/lib/core_ext/string_to_sort_atoms.rb
@@ -1,5 +1,4 @@
class SmartSortAtom
-
attr_reader :value
def initialize(value)
@@ -7,10 +6,10 @@ def initialize(value)
end
def <=>(other)
- other.is_a?(self.class) or raise "Can only smart compare with other SmartSortAtom"
+ other.is_a?(self.class) or raise("Can only smart compare with other SmartSortAtom")
left_value = value
right_value = other.value
- if left_value.class == right_value.class
+ if left_value.instance_of?(right_value.class)
left_value <=> right_value
elsif left_value.is_a?(Float)
-1
@@ -22,31 +21,23 @@ def <=>(other)
def self.parse(string)
# Loosely based on http://stackoverflow.com/a/4079031
string.scan(/[^\d\.]+|[\d\.]+/).collect do |atom|
- if atom.match(/\d+(\.\d+)?/)
- atom = atom.to_f
+ atom = if /\d+(\.\d+)?/.match?(atom)
+ atom.to_f
else
- atom = normalize_string(atom)
+ normalize_string(atom)
end
new(atom)
end
-
end
- private
-
def self.normalize_string(string)
string = ActiveSupport::Inflector.transliterate(string)
- string = string.downcase
- string
+ string.downcase
end
-
end
String.class_eval do
-
def to_sort_atoms
SmartSortAtom.parse(self)
end
-
end
-
diff --git a/lib/scrapers/scrapers.rb b/lib/scrapers/scrapers.rb
index cbb51eb5a..769894f6e 100644
--- a/lib/scrapers/scrapers.rb
+++ b/lib/scrapers/scrapers.rb
@@ -1,34 +1,34 @@
-require 'nokogiri'
-require 'open-uri'
-require 'openssl'
+require "nokogiri"
+require "open-uri"
+require "openssl"
# OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
class CamtasiaScraper
-
def initialize(link)
- html = Nokogiri::HTML(open(link))
+ html = Nokogiri::HTML(URI.parse(link).open)
# find xml and init the tree if to be found
- if html.search('iframe').empty?
+ if html.search("iframe").empty?
xml_file = /setXMPSrc\("(.*?)"\)/.match(html)[1]
- @xml = Nokogiri::XML(open(URI.join(link, xml_file))).remove_namespaces!
+ xml_text = URI.parse(URI.join(link, xml_file)).open
+ @xml = Nokogiri::XML(xml_text).remove_namespaces!
# follow the iframe if we have one
else
- src = html.search('iframe').first['src']
+ src = html.search("iframe").first["src"]
initialize(URI.join(link, src))
end
end
def toc
@xml.search('Description[@trackType="TableOfContents"]/markers/Seq/li/Description').map do |i|
- { start_time: i.xpath('@startTime').to_s.to_i, text: i.xpath('@name').to_s }
+ { start_time: i.xpath("@startTime").to_s.to_i, text: i.xpath("@name").to_s }
end
end
def references
@xml.search('Description[@trackType="Hotspot"]/markers/Seq/li/Description').map do |i|
- { start_time: i.xpath('@startTime').to_s.to_i, link: i.xpath('@location').to_s }
+ { start_time: i.xpath("@startTime").to_s.to_i, link: i.xpath("@location").to_s }
end
end
diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake
index a1ce02aff..d7aa4dd01 100644
--- a/lib/tasks/db.rake
+++ b/lib/tasks/db.rake
@@ -31,70 +31,74 @@
# Original source: https://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90
# Merged with: https://gist.github.com/kofronpi/37130f5ed670465b1fe2d170f754f8c6
namespace :db do
- desc 'Dumps the database to backups'
+ desc "Dumps the database to backups"
task dump: :environment do
- dump_fmt = ensure_format(ENV['format'])
+ dump_fmt = ensure_format(ENV.fetch("format", nil))
dump_sfx = suffix_for_format(dump_fmt)
backup_dir = backup_directory(Rails.env, create: true)
full_path = nil
cmd = nil
- with_config do |app, host, db, user|
- full_path = "#{backup_dir}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{db}.#{dump_sfx}"
+ with_config do |_app, host, db, user|
+ full_path = "#{backup_dir}/#{Time.zone.now.strftime("%Y%m%d%H%M%S")}_#{db}.#{dump_sfx}"
+ # rubocop:disable Layout/LineLength
cmd = "pg_dump -F #{dump_fmt} -v -O -w -U '#{user}' -h '#{host}' -d '#{db}' -f '#{full_path}'"
+ # rubocop:enable Layout/LineLength
end
puts cmd
system cmd
- puts ''
+ puts ""
puts "Dumped to file: #{full_path}"
- puts ''
+ puts ""
end
namespace :dump do
- desc 'Dumps a specific table to backups'
+ desc "Dumps a specific table to backups"
task table: :environment do
- table_name = ENV['table']
+ table_name = ENV.fetch("table", nil)
if table_name.present?
- dump_fmt = ensure_format(ENV['format'])
+ dump_fmt = ensure_format(ENV.fetch("format", nil))
dump_sfx = suffix_for_format(dump_fmt)
backup_dir = backup_directory(Rails.env, create: true)
full_path = nil
cmd = nil
- with_config do |app, host, db, user|
- full_path = "#{backup_dir}/#{Time.now.strftime('%Y%m%d%H%M%S')}_#{db}.#{table_name.parameterize.underscore}.#{dump_sfx}"
+ with_config do |_app, host, db, user|
+ # rubocop:disable Layout/LineLength
+ full_path = "#{backup_dir}/#{Time.zone.now.strftime("%Y%m%d%H%M%S")}_#{db}.#{table_name.parameterize.underscore}.#{dump_sfx}"
cmd = "pg_dump -F #{dump_fmt} -v -O -w -U '#{user}' -h '#{host}' -d '#{db}' -t '#{table_name}' -f '#{full_path}'"
+ # rubocop:enable Layout/LineLength
end
puts cmd
system cmd
- puts ''
+ puts ""
puts "Dumped to file: #{full_path}"
- puts ''
+ puts ""
else
- puts 'Please specify a table name'
+ puts "Please specify a table name"
end
end
end
- desc 'Show the existing database backups'
+ desc "Show the existing database backups"
task dumps: :environment do
backup_dir = backup_directory
- puts "#{backup_dir}"
+ puts backup_dir
system "/bin/ls -ltR #{backup_dir}"
end
- desc 'Restores the database from a backup using PATTERN'
+ desc "Restores the database from a backup using PATTERN"
task restore: :environment do
- pattern = ENV['pattern']
+ pattern = ENV.fetch("pattern", nil)
if pattern.present?
file = nil
cmd = nil
- with_config do |app, host, db, user|
+ with_config do |_app, host, db, user|
backup_dir = backup_directory
files = Dir.glob("#{backup_dir}/**/*#{pattern}*")
@@ -103,22 +107,22 @@ namespace :db do
puts "No backups found for the pattern '#{pattern}'"
when 1
file = files.first
- fmt = format_for_file file
+ fmt = format_for_file(file)
case fmt
when nil
puts "No recognized dump file suffix: #{file}"
- when 'p'
+ when "p"
cmd = "psql -U '#{user}' -h '#{host}' -d '#{db}' -f '#{file}'"
else
cmd = "pg_restore -F #{fmt} -v -c -C -U '#{user}' -h '#{host}' -d '#{db}' -f '#{file}'"
end
else
puts "Too many files match the pattern '#{pattern}':"
- puts ' ' + files.join("\n ")
- puts ''
+ puts " #{files.join("\n ")}"
+ puts ""
puts "Try a more specific pattern"
- puts ''
+ puts ""
end
end
unless cmd.nil?
@@ -127,64 +131,65 @@ namespace :db do
puts cmd
system cmd
Rake::Task["sunspot:reindex"].invoke
- puts ''
+ puts ""
puts "Restored from file: #{file}"
- puts ''
+ puts ""
end
else
- puts 'Please specify a file pattern for the backup to restore (e.g. timestamp)'
+ puts "Please specify a file pattern for the backup to restore (e.g. timestamp)"
end
end
private
- def ensure_format(format)
- return format if %w[c p t d].include?(format)
+ def ensure_format(format)
+ format_lookup = {
+ "dump" => "c",
+ "sql" => "p",
+ "tar" => "t",
+ "dir" => "d"
+ }
- case format
- when 'dump' then 'c'
- when 'sql' then 'p'
- when 'tar' then 't'
- when 'dir' then 'd'
- else 'p'
+ return format if format_lookup.value?(format)
+
+ format_lookup.key?(format) ? format_lookup[format] : "p"
end
- end
- def suffix_for_format(suffix)
- case suffix
- when 'c' then 'dump'
- when 'p' then 'sql'
- when 't' then 'tar'
- when 'd' then 'dir'
- else nil
+ def suffix_for_format(suffix)
+ suffix_lookup = {
+ "c" => "dump",
+ "p" => "sql",
+ "t" => "tar",
+ "d" => "dir"
+ }
+
+ suffix_lookup[suffix]
end
- end
- def format_for_file(file)
- case file
- when /\.dump$/ then 'c'
- when /\.sql$/ then 'p'
- when /\.dir$/ then 'd'
- when /\.tar$/ then 't'
- else nil
+ def format_for_file(file)
+ case file
+ when /\.dump$/ then "c"
+ when /\.sql$/ then "p"
+ when /\.dir$/ then "d"
+ when /\.tar$/ then "t"
+ end
end
- end
- def backup_directory(suffix = nil, create: false)
- backup_dir = File.join(*[Rails.root, 'db/backups', suffix].compact)
+ def backup_directory(_suffix = nil, create: false)
+ backup_dir = Rails.root.join.to_s
- if create and not Dir.exists?(backup_dir)
- puts "Creating #{backup_dir} .."
- FileUtils.mkdir_p(backup_dir)
- end
+ if create && !Dir.exist?(backup_dir)
+ puts "Creating #{backup_dir} .."
+ FileUtils.mkdir_p(backup_dir)
+ end
- backup_dir
- end
+ backup_dir
+ end
- def with_config
- yield Rails.application.class.module_parent_name.underscore,
- ActiveRecord::Base.connection_db_config.host,
- ActiveRecord::Base.connection_db_config.database,
- ActiveRecord::Base.connection_db_config.configuration_hash[:username]
- end
-end
\ No newline at end of file
+ def with_config
+ yield(Rails.application.class.module_parent_name.underscore,
+ ActiveRecord::Base.connection_db_config.host,
+ ActiveRecord::Base.connection_db_config.database,
+ ActiveRecord::Base.connection_db_config.configuration_hash[:username])
+ end
+end
diff --git a/lib/tasks/mampf_setup.rake b/lib/tasks/mampf_setup.rake
index 2fc50811b..e41b9e08e 100644
--- a/lib/tasks/mampf_setup.rake
+++ b/lib/tasks/mampf_setup.rake
@@ -1,7 +1,6 @@
namespace :mampf_setup do
desc "This poulates the cache for mampf."
task populate_cache: :environment do
- Medium.where.not(teachable: nil).map(&:scoped_teachable)
+ Medium.where.not(teachable: nil).map(&:scoped_teachable)
end
-
end
diff --git a/spec/controllers/chapters_controller_spec.rb b/spec/controllers/chapters_controller_spec.rb
index 3ffd36b5a..6a0c35064 100644
--- a/spec/controllers/chapters_controller_spec.rb
+++ b/spec/controllers/chapters_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe ChaptersController, type: :controller do
+RSpec.describe(ChaptersController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#show' do
diff --git a/spec/controllers/courses_controller_spec.rb b/spec/controllers/courses_controller_spec.rb
index 77fb89f07..a6a4ea85f 100644
--- a/spec/controllers/courses_controller_spec.rb
+++ b/spec/controllers/courses_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe CoursesController, type: :controller do
+RSpec.describe(CoursesController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#show' do
diff --git a/spec/controllers/lessons_controller_spec.rb b/spec/controllers/lessons_controller_spec.rb
index 7d8ae4f1b..0aae1b13f 100644
--- a/spec/controllers/lessons_controller_spec.rb
+++ b/spec/controllers/lessons_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe LessonsController, type: :controller do
+RSpec.describe(LessonsController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#show' do
diff --git a/spec/controllers/main_controller_spec.rb b/spec/controllers/main_controller_spec.rb
index 392e4430d..325f92f89 100644
--- a/spec/controllers/main_controller_spec.rb
+++ b/spec/controllers/main_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MainController, type: :controller do
+RSpec.describe(MainController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#home' do
diff --git a/spec/controllers/media_controller_spec.rb b/spec/controllers/media_controller_spec.rb
index 81a3e8bb9..c329ef6ef 100644
--- a/spec/controllers/media_controller_spec.rb
+++ b/spec/controllers/media_controller_spec.rb
@@ -1,11 +1,8 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MediaController, type: :controller do
+RSpec.describe(MediaController, type: :controller) do
# NEEDS TO BE REFACTORED
-
# describe '#index' do
# before do
# FactoryBot.create(:medium)
diff --git a/spec/controllers/profile_controller_spec.rb b/spec/controllers/profile_controller_spec.rb
index 57cdd3eb4..129695062 100644
--- a/spec/controllers/profile_controller_spec.rb
+++ b/spec/controllers/profile_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe ProfileController, type: :controller do
+RSpec.describe(ProfileController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#edit' do
diff --git a/spec/controllers/search_controller_spec.rb b/spec/controllers/search_controller_spec.rb
index 8ec4ef659..19bde300c 100644
--- a/spec/controllers/search_controller_spec.rb
+++ b/spec/controllers/search_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe SearchController, type: :controller do
+RSpec.describe(SearchController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#index' do
diff --git a/spec/controllers/sections_controller_spec.rb b/spec/controllers/sections_controller_spec.rb
index 947063307..551d16b55 100644
--- a/spec/controllers/sections_controller_spec.rb
+++ b/spec/controllers/sections_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe SectionsController, type: :controller do
+RSpec.describe(SectionsController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#show' do
diff --git a/spec/controllers/tags_controller_spec.rb b/spec/controllers/tags_controller_spec.rb
index 9435e4a6c..eae1a423f 100644
--- a/spec/controllers/tags_controller_spec.rb
+++ b/spec/controllers/tags_controller_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe TagsController, type: :controller do
+RSpec.describe(TagsController, type: :controller) do
# NEEDS TO BE REFACTORED
# describe '#show' do
diff --git a/spec/cypress/app_commands/activerecord_fixtures.rb b/spec/cypress/app_commands/activerecord_fixtures.rb
index ae6b6875f..881319b7a 100644
--- a/spec/cypress/app_commands/activerecord_fixtures.rb
+++ b/spec/cypress/app_commands/activerecord_fixtures.rb
@@ -1,27 +1,25 @@
-# frozen_string_literal: true
-
# you can delete this file if you don't use Rails Test Fixtures
-fixtures_dir = command_options.try(:[], 'fixtures_dir')
-fixture_files = command_options.try(:[], 'fixtures')
+fixtures_dir = command_options.try(:[], "fixtures_dir")
+fixture_files = command_options.try(:[], "fixtures")
if defined?(ActiveRecord)
- require 'active_record/fixtures'
+ require "active_record/fixtures"
fixtures_dir ||= ActiveRecord::Tasks::DatabaseTasks.fixtures_path
fixture_files ||= Dir["#{fixtures_dir}/**/*.yml"]
- .map { |f| f[(fixtures_dir.size + 1)..-5] }
+ .pluck((fixtures_dir.size + 1)..-5)
- logger.debug "loading fixtures: { dir: #{fixtures_dir}, " +
- "files: #{fixture_files} }"
+ logger.debug("loading fixtures: { dir: #{fixtures_dir}, " \
+ "files: #{fixture_files} }")
ActiveRecord::FixtureSet.reset_cache
ActiveRecord::FixtureSet.create_fixtures(fixtures_dir, fixture_files)
- 'Fixtures Done' # this gets returned
+ "Fixtures Done" # this gets returned
else # this else part can be removed
- logger.error 'Looks like activerecord_fixtures has to be modified to suite ' \
- 'your need'
- Post.create(title: 'MyCypressFixtures')
- Post.create(title: 'MyCypressFixtures2')
- Post.create(title: 'MyRailsFixtures')
- Post.create(title: 'MyRailsFixtures2')
+ logger.error("Looks like activerecord_fixtures has to be modified to suite " \
+ "your need")
+ Post.create(title: "MyCypressFixtures")
+ Post.create(title: "MyCypressFixtures2")
+ Post.create(title: "MyRailsFixtures")
+ Post.create(title: "MyRailsFixtures2")
end
diff --git a/spec/cypress/app_commands/clean.rb b/spec/cypress/app_commands/clean.rb
index 862ca6eb0..798ca3338 100644
--- a/spec/cypress/app_commands/clean.rb
+++ b/spec/cypress/app_commands/clean.rb
@@ -1,12 +1,10 @@
-# frozen_string_literal: true
-
if defined?(DatabaseCleaner)
# cleaning the database using database_cleaner
DatabaseCleaner.strategy = :truncation
DatabaseCleaner.clean
else
- logger.warn 'add database_cleaner or update cypress/app_commands/clean.rb'
+ logger.warn("add database_cleaner or update cypress/app_commands/clean.rb")
Post.delete_all if defined?(Post)
end
-Rails.logger.info 'APPCLEANED' # used by log_fail.rb
+Rails.logger.info("APPCLEANED") # used by log_fail.rb
diff --git a/spec/cypress/app_commands/eval.rb b/spec/cypress/app_commands/eval.rb
index e7ef2d05d..3a39bf3e2 100644
--- a/spec/cypress/app_commands/eval.rb
+++ b/spec/cypress/app_commands/eval.rb
@@ -1,3 +1 @@
-# frozen_string_literal: true
-
Kernel.eval(command_options) unless command_options.nil?
diff --git a/spec/cypress/app_commands/factory_bot.rb b/spec/cypress/app_commands/factory_bot.rb
index 852a5ce8b..135d955b4 100644
--- a/spec/cypress/app_commands/factory_bot.rb
+++ b/spec/cypress/app_commands/factory_bot.rb
@@ -1,16 +1,14 @@
-# frozen_string_literal: true
-
-require 'cypress_on_rails/smart_factory_wrapper'
+require "cypress_on_rails/smart_factory_wrapper"
Array.wrap(command_options).map do |factory_options|
factory_method = factory_options.shift
begin
- logger.debug "running #{factory_method}, #{factory_options}"
+ logger.debug("running #{factory_method}, #{factory_options}")
CypressOnRails::SmartFactoryWrapper.public_send(factory_method,
*factory_options)
rescue StandardError => e
- logger.error "#{e.class}: #{e.message}"
- logger.error e.backtrace.join("\n")
- logger.error e.record.inspect.to_s if e.is_a?(ActiveRecord::RecordInvalid)
- raise e
+ logger.error("#{e.class}: #{e.message}")
+ logger.error(e.backtrace.join("\n"))
+ logger.error(e.record.inspect.to_s) if e.is_a?(ActiveRecord::RecordInvalid)
+ raise(e)
end
end
diff --git a/spec/cypress/app_commands/log_fail.rb b/spec/cypress/app_commands/log_fail.rb
index b118504b8..ed25a5927 100644
--- a/spec/cypress/app_commands/log_fail.rb
+++ b/spec/cypress/app_commands/log_fail.rb
@@ -1,31 +1,29 @@
-# frozen_string_literal: true
-
# This file is called when a cypress spec fails and allows for extra logging
# to be captured
-filename = command_options.fetch('runnable_full_title', 'no title')
- .gsub(/[^[:print:]]/, '')
+filename = command_options.fetch("runnable_full_title", "no title")
+ .gsub(/[^[:print:]]/, "")
# grab last lines until "APPCLEANED"
# (Make sure in clean.rb to log the text "APPCLEANED")
-system "tail -n 10000 -r log/#{Rails.env}.log | " +
+system "tail -n 10000 -r log/#{Rails.env}.log | " \
"sed \"/APPCLEANED/ q\" | sed 'x;1!H;$!d;x' > 'log/#{filename}.log'"
# create a json debug file for server debugging
json_result = {}
-json_result['error'] = command_options.fetch('error_message',
- 'no error message')
+json_result["error"] = command_options.fetch("error_message",
+ "no error message")
if defined?(ActiveRecord::Base)
- json_result['records'] =
+ json_result["records"] =
ActiveRecord::Base.descendants
.each_with_object({}) do |record_class, records|
records[record_class.to_s] = record_class.limit(100).map(&:attributes)
- rescue
+ rescue StandardError # rubocop:todo Lint/SuppressedException
end
end
-filename = command_options.fetch('runnable_full_title', 'no title')
- .gsub(/[^[:print:]]/, '')
-File.open("#{Rails.root}/log/#{filename}.json", 'w+') do |file|
+filename = command_options.fetch("runnable_full_title", "no title")
+ .gsub(/[^[:print:]]/, "")
+File.open(Rails.root.join("log/#{filename}.json").to_s, "w+") do |file|
file << JSON.pretty_generate(json_result)
end
diff --git a/spec/cypress/app_commands/scenarios/admin.rb b/spec/cypress/app_commands/scenarios/admin.rb
index a12edbe21..9505d4dcf 100644
--- a/spec/cypress/app_commands/scenarios/admin.rb
+++ b/spec/cypress/app_commands/scenarios/admin.rb
@@ -1,4 +1,2 @@
-# frozen_string_literal: true
-
-User.create(name: 'Admin', email: 'administrator@mampf.edu',
- password: 'test123456', admin: true, consents: true).confirm
+User.create(name: "Admin", email: "administrator@mampf.edu",
+ password: "test123456", admin: true, consents: true).confirm
diff --git a/spec/cypress/app_commands/scenarios/course_created.rb b/spec/cypress/app_commands/scenarios/course_created.rb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/spec/cypress/app_commands/scenarios/editor.rb b/spec/cypress/app_commands/scenarios/editor.rb
index 0b45fa905..f1dbbc3b5 100644
--- a/spec/cypress/app_commands/scenarios/editor.rb
+++ b/spec/cypress/app_commands/scenarios/editor.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
-User.create(name: 'Max Mustermann', email: 'editor@mampf.edu',
- password: 'test123456', consents: true,
+User.create(name: "Max Mustermann", email: "editor@mampf.edu",
+ password: "test123456", consents: true,
locale: I18n.default_locale).confirm
diff --git a/spec/cypress/app_commands/scenarios/non_admin.rb b/spec/cypress/app_commands/scenarios/non_admin.rb
index 1dbaa595e..9d76635d4 100644
--- a/spec/cypress/app_commands/scenarios/non_admin.rb
+++ b/spec/cypress/app_commands/scenarios/non_admin.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
-User.create(name: 'Max Mustermann', email: 'max@mampf.edu',
- password: 'test123456', consents: true,
+User.create(name: "Max Mustermann", email: "max@mampf.edu",
+ password: "test123456", consents: true,
locale: I18n.default_locale).confirm
diff --git a/spec/cypress/app_commands/scenarios/setup.rb b/spec/cypress/app_commands/scenarios/setup.rb
deleted file mode 100644
index e69de29bb..000000000
diff --git a/spec/cypress/app_commands/scenarios/teacher.rb b/spec/cypress/app_commands/scenarios/teacher.rb
index 55a3d6969..d9eb4fd9f 100644
--- a/spec/cypress/app_commands/scenarios/teacher.rb
+++ b/spec/cypress/app_commands/scenarios/teacher.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
-User.create(name: 'Max Mustermann', email: 'teacher@mampf.edu',
- password: 'test123456', consents: true,
+User.create(name: "Max Mustermann", email: "teacher@mampf.edu",
+ password: "test123456", consents: true,
locale: I18n.default_locale).confirm
diff --git a/spec/cypress/cypress_helper.rb b/spec/cypress/cypress_helper.rb
index c96b66c67..6e5fc804e 100644
--- a/spec/cypress/cypress_helper.rb
+++ b/spec/cypress/cypress_helper.rb
@@ -1,25 +1,23 @@
-# frozen_string_literal: true
-
# This is loaded once before the first command is executed
begin
- require 'database_cleaner'
- rescue LoadError => e
- puts e.message
+ require "database_cleaner"
+rescue LoadError => e
+ puts e.message
end
begin
- require 'factory_bot_rails'
+ require "factory_bot_rails"
rescue LoadError => e
puts e.message
begin
- require 'factory_girl_rails'
+ require "factory_girl_rails"
rescue LoadError => e
puts e.message
end
end
-require 'cypress_on_rails/smart_factory_wrapper'
+require "cypress_on_rails/smart_factory_wrapper"
factory = CypressOnRails::SimpleRailsFactory
factory = FactoryBot if defined?(FactoryBot)
@@ -29,6 +27,6 @@
always_reload: !Rails.configuration.cache_classes,
factory: factory,
files: [
- Rails.root.join('spec', 'factories', '**', '*.rb')
+ Rails.root.join("spec/factories/**/*.rb")
]
)
diff --git a/spec/factories/announcements.rb b/spec/factories/announcements.rb
index 9f9ae4e6f..c52ad6877 100644
--- a/spec/factories/announcements.rb
+++ b/spec/factories/announcements.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :announcement do
association :announcer, factory: :confirmed_user
diff --git a/spec/factories/answers.rb b/spec/factories/answers.rb
index a0748a10a..2a517a1a6 100644
--- a/spec/factories/answers.rb
+++ b/spec/factories/answers.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :answer do
trait :with_question do
diff --git a/spec/factories/assignments.rb b/spec/factories/assignments.rb
index 11c80ba1e..df677ce93 100644
--- a/spec/factories/assignments.rb
+++ b/spec/factories/assignments.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :assignment do
title do
@@ -8,14 +6,14 @@
end
deadline { Faker::Time.forward(days: 30) }
deletion_date { Faker::Date.forward(days: 60) }
- accepted_file_type { '.pdf' }
+ accepted_file_type { ".pdf" }
trait :with_lecture do
association :lecture, :released_for_all
end
trait :inactive do
- deadline { Faker::Time.backward(days: 30)}
+ deadline { Faker::Time.backward(days: 30) }
end
factory :valid_assignment, traits: [:with_lecture]
diff --git a/spec/factories/chapters.rb b/spec/factories/chapters.rb
index a347b26ab..69806bc97 100644
--- a/spec/factories/chapters.rb
+++ b/spec/factories/chapters.rb
@@ -1,13 +1,10 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :chapter do
association :lecture, factory: [:lecture]
title do
- Faker::Book.title + ' ' +
- Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
transient do
diff --git a/spec/factories/clicker_votes.rb b/spec/factories/clicker_votes.rb
index 2635fbffa..78cdd792a 100644
--- a/spec/factories/clicker_votes.rb
+++ b/spec/factories/clicker_votes.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :clicker_vote do
value { [1, 2, 3].sample }
diff --git a/spec/factories/clickers.rb b/spec/factories/clickers.rb
index 4eed895cd..02d30abfb 100644
--- a/spec/factories/clickers.rb
+++ b/spec/factories/clickers.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :clicker do
title { Faker::Book.title + Faker::Number.between(from: 1, to: 9999).to_s }
diff --git a/spec/factories/consumptions.rb b/spec/factories/consumptions.rb
index 8a1b251b0..7148f792c 100644
--- a/spec/factories/consumptions.rb
+++ b/spec/factories/consumptions.rb
@@ -1,15 +1,15 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :consumption do
trait :with_stuff do
medium_id { Faker::Number.number }
- sort { ['video', 'manuscript'].sample }
+ # rubocop:disable Performance/CollectionLiteralInLoop
+ sort { ["video", "manuscript"].sample }
+ # rubocop:enable Performance/CollectionLiteralInLoop
after :build do |consumption|
- consumption.mode = if consumption.sort == 'video'
- ['thyme', 'download'].sample
+ consumption.mode = if consumption.sort == "video"
+ ["thyme", "download"].sample
else
- ['pdf_view', 'download'].sample
+ ["pdf_view", "download"].sample
end
end
end
diff --git a/spec/factories/course_self_joins.rb b/spec/factories/course_self_joins.rb
index fc10bd8de..1f7ff2882 100644
--- a/spec/factories/course_self_joins.rb
+++ b/spec/factories/course_self_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :course_self_join do
association :course
diff --git a/spec/factories/course_tag_joins.rb b/spec/factories/course_tag_joins.rb
index 752ef3d91..433e95da2 100644
--- a/spec/factories/course_tag_joins.rb
+++ b/spec/factories/course_tag_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :course_tag_join do
association :tag
diff --git a/spec/factories/courses.rb b/spec/factories/courses.rb
index c53df2b36..2a645fb12 100644
--- a/spec/factories/courses.rb
+++ b/spec/factories/courses.rb
@@ -1,14 +1,10 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :course do
title do
- Faker::Book.title + ' ' +
- Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
short_title do
- Faker::Book.title + ' ' +
- Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
transient do
@@ -25,12 +21,12 @@
end
trait :locale_de do
- locale { 'de' }
+ locale { "de" }
end
trait :with_image do
after(:build) do |c|
- c.image = File.open("#{SPEC_FILES}/image.png", 'rb')
+ c.image = File.open("#{SPEC_FILES}/image.png", "rb")
end
end
diff --git a/spec/factories/division_course_joins.rb b/spec/factories/division_course_joins.rb
index 14a0ecea6..d47bc715a 100644
--- a/spec/factories/division_course_joins.rb
+++ b/spec/factories/division_course_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :division_course_join do
association :division
diff --git a/spec/factories/divisions.rb b/spec/factories/divisions.rb
index 6c7c10166..4cf67a821 100644
--- a/spec/factories/divisions.rb
+++ b/spec/factories/divisions.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :division do
association :program
diff --git a/spec/factories/editable_user_joins.rb b/spec/factories/editable_user_joins.rb
index 9dc74013d..d998c57c6 100644
--- a/spec/factories/editable_user_joins.rb
+++ b/spec/factories/editable_user_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :editable_user_join do
association :user, factory: :confirmed_user
diff --git a/spec/factories/imports.rb b/spec/factories/imports.rb
index 65ee9d98d..75ebc0156 100644
--- a/spec/factories/imports.rb
+++ b/spec/factories/imports.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :import do
transient do
diff --git a/spec/factories/interactions.rb b/spec/factories/interactions.rb
index b73b8101b..042c5da47 100644
--- a/spec/factories/interactions.rb
+++ b/spec/factories/interactions.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :interaction do
trait :with_stuff do
diff --git a/spec/factories/item_self_joins.rb b/spec/factories/item_self_joins.rb
index 9c8824f6e..da18e18a5 100644
--- a/spec/factories/item_self_joins.rb
+++ b/spec/factories/item_self_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :item_self_join do
association :item
diff --git a/spec/factories/items.rb b/spec/factories/items.rb
index 3610318c8..eb0b2c407 100644
--- a/spec/factories/items.rb
+++ b/spec/factories/items.rb
@@ -1,8 +1,8 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :item do
- sort { ['remark', 'example', 'theorem', 'definition'].sample }
+ # rubocop:disable Performance/CollectionLiteralInLoop
+ sort { ["remark", "example", "theorem", "definition"].sample }
+ # rubocop:enable Performance/CollectionLiteralInLoop
transient do
starting_time { Faker::Number.decimal(l_digits: 4, r_digits: 3) }
diff --git a/spec/factories/lecture_user_joins.rb b/spec/factories/lecture_user_joins.rb
index 7f5d52eb8..8f016c19c 100644
--- a/spec/factories/lecture_user_joins.rb
+++ b/spec/factories/lecture_user_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :lecture_user_join do
association :lecture
diff --git a/spec/factories/lectures.rb b/spec/factories/lectures.rb
index 8617a5e4b..cadd60178 100644
--- a/spec/factories/lectures.rb
+++ b/spec/factories/lectures.rb
@@ -1,13 +1,11 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :lecture do
association :course
association :teacher, factory: :confirmed_user
association :term
- content_mode { 'video' }
- sort { 'lecture' }
+ content_mode { "video" }
+ sort { "lecture" }
transient do
chapter_count { 3 }
@@ -19,7 +17,7 @@
end
trait :released_for_all do
- released { 'all' }
+ released { "all" }
end
trait :term_independent do
@@ -45,7 +43,7 @@
end
trait :is_seminar do
- sort { 'seminar' }
+ sort { "seminar" }
end
trait :with_forum do
@@ -56,7 +54,7 @@
end
end
- # note that you can give the chapter_count here as parameter as well
+ # NOTE: that you can give the chapter_count here as parameter as well
factory :lecture_with_toc, traits: [:with_toc]
factory :lecture_with_sparse_toc, traits: [:with_sparse_toc]
diff --git a/spec/factories/lesson_section_joins.rb b/spec/factories/lesson_section_joins.rb
index 6938c7538..b2adcda99 100644
--- a/spec/factories/lesson_section_joins.rb
+++ b/spec/factories/lesson_section_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :lesson_section_join do
association :lesson
diff --git a/spec/factories/lesson_tag_joins.rb b/spec/factories/lesson_tag_joins.rb
index 7221eeb8e..a7230133d 100644
--- a/spec/factories/lesson_tag_joins.rb
+++ b/spec/factories/lesson_tag_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :lesson_tag_join do
association :lesson
diff --git a/spec/factories/lessons.rb b/spec/factories/lessons.rb
index c8cc1306c..b41c8abaa 100644
--- a/spec/factories/lessons.rb
+++ b/spec/factories/lessons.rb
@@ -1,6 +1,4 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :lesson do
diff --git a/spec/factories/links.rb b/spec/factories/links.rb
index 73a11d177..732ffbce7 100644
--- a/spec/factories/links.rb
+++ b/spec/factories/links.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :link do
association :medium
diff --git a/spec/factories/mampf_expressions.rb b/spec/factories/mampf_expressions.rb
index c605d9ded..02dad3c13 100644
--- a/spec/factories/mampf_expressions.rb
+++ b/spec/factories/mampf_expressions.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :mampf_expression do
transient do
diff --git a/spec/factories/mampf_matrices.rb b/spec/factories/mampf_matrices.rb
index 3e33fbfe6..0d87033b4 100644
--- a/spec/factories/mampf_matrices.rb
+++ b/spec/factories/mampf_matrices.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :mampf_matrix do
transient do
@@ -11,7 +9,7 @@
a_22 { Faker::Number.between(from: -3, to: 3).to_s }
coefficients { [a_11, a_12, a_21, a_22] }
tex do
- "\\begin{pmatrix} #{a_11} & #{a_12} \\cr " +
+ "\\begin{pmatrix} #{a_11} & #{a_12} \\cr " \
"#{a_21} & #{a_22} \\end{pmatrix}"
end
nerd { "matrix([#{a_11},#{a_12}],[#{a_21},#{a_22}]" }
diff --git a/spec/factories/mampf_sets.rb b/spec/factories/mampf_sets.rb
index e9b41ad19..54f6d362f 100644
--- a/spec/factories/mampf_sets.rb
+++ b/spec/factories/mampf_sets.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :mampf_set do
transient do
diff --git a/spec/factories/mampf_tuples.rb b/spec/factories/mampf_tuples.rb
index 1dae5e1df..f0b002958 100644
--- a/spec/factories/mampf_tuples.rb
+++ b/spec/factories/mampf_tuples.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :mampf_tuple do
transient do
diff --git a/spec/factories/manuscripts.rb b/spec/factories/manuscripts.rb
index 254c5fc94..fa1a67eac 100644
--- a/spec/factories/manuscripts.rb
+++ b/spec/factories/manuscripts.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :manuscript do
transient do
diff --git a/spec/factories/media.rb b/spec/factories/media.rb
index 6b2a39b58..1d43ec5a4 100644
--- a/spec/factories/media.rb
+++ b/spec/factories/media.rb
@@ -1,6 +1,4 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :medium do
@@ -48,30 +46,30 @@
trait :with_manuscript do
after(:build) do |m|
- m.manuscript = File.open("#{SPEC_FILES}/manuscript.pdf", 'rb')
+ m.manuscript = File.open("#{SPEC_FILES}/manuscript.pdf", "rb")
end
end
trait :released do
after(:build) do |m|
# first release the lecture
- l= m.teachable.lecture
- l.released = 'all'
+ l = m.teachable.lecture
+ l.released = "all"
l.save
- m.released = 'all'
- m.released_at = Time.now
+ m.released = "all"
+ m.released_at = Time.zone.now
m.save!
end
end
trait :with_video do
after(:build) do |m|
- m.video = File.open("#{SPEC_FILES}/talk.mp4", 'rb')
+ m.video = File.open("#{SPEC_FILES}/talk.mp4", "rb")
end
end
factory :lesson_medium,
traits: [:with_description, :with_teachable] do
- sort { 'Kaviar' }
+ sort { "Kaviar" }
teachable_sort { :valid_lesson }
after(:build) { |m| m.editors << m.teachable.lecture.teacher }
end
@@ -79,19 +77,19 @@
factory :lecture_medium,
traits: [:with_description, :with_teachable],
aliases: [:valid_medium] do
- sort { 'Sesam' }
+ sort { "Sesam" }
after(:build) { |m| m.editors << m.teachable.teacher }
end
factory :course_medium,
traits: [:with_description, :with_teachable, :with_editors] do
- sort { 'Sesam' }
+ sort { "Sesam" }
teachable_sort { :course }
end
factory :talk_medium,
traits: [:with_description, :with_teachable] do
- sort { 'Kaviar' }
+ sort { "Kaviar" }
teachable_sort { :valid_talk_with_speaker }
after(:build) { |m| m.editors << m.teachable.lecture.teacher }
end
diff --git a/spec/factories/medium_publisher.rb b/spec/factories/medium_publisher.rb
index d4ffc0f89..1ddc0d981 100644
--- a/spec/factories/medium_publisher.rb
+++ b/spec/factories/medium_publisher.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :medium_publisher do
transient do
@@ -7,14 +5,14 @@
user_id { Faker::Number.between(from: 1, to: 20) }
release_now { true }
release_date do
- DateTime.now + 10 * Faker::Number.between(from: 0.0, to: 1.0)
+ DateTime.now + (10 * Faker::Number.between(from: 0.0, to: 1.0))
end
- release_for { 'all' }
+ release_for { "all" }
lock_comments { false }
vertices { false }
create_assignment { false }
- assignment_title { '' }
- assignment_file_type { '' }
+ assignment_title { "" }
+ assignment_file_type { "" }
assignment_deadline { nil }
assignment_deletion_date { nil }
end
diff --git a/spec/factories/medium_tag_joins.rb b/spec/factories/medium_tag_joins.rb
index 901c66875..a4039911d 100644
--- a/spec/factories/medium_tag_joins.rb
+++ b/spec/factories/medium_tag_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :medium_tag_join do
association :medium
diff --git a/spec/factories/notifications.rb b/spec/factories/notifications.rb
index 8bd9fb8a1..050422fcd 100644
--- a/spec/factories/notifications.rb
+++ b/spec/factories/notifications.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :notification do
association :recipient, factory: :confirmed_user
@@ -7,7 +5,7 @@
trait :with_notifiable do
transient do
notifiable_sort do
- ['Medium', 'Course', 'Lecture', 'Announcement'].sample
+ ["Medium", "Course", "Lecture", "Announcement"].sample
end
end
after :build do |n, evaluator|
diff --git a/spec/factories/notions.rb b/spec/factories/notions.rb
index a52b70ec1..a711c766d 100644
--- a/spec/factories/notions.rb
+++ b/spec/factories/notions.rb
@@ -1,16 +1,13 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :notion, aliases: [:related_notion] do
# to get a valid notion, a tag has to be added
# in order to avoid loops in the creation of tags (which need a notion)
# the adding of a tag is done in the valid_notion factory
- locale { 'de' }
+ locale { "de" }
title do
- Faker::Book.title + ' ' +
- Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
trait :with_tag do
diff --git a/spec/factories/probes.rb b/spec/factories/probes.rb
index b8092d877..91bd9ae56 100644
--- a/spec/factories/probes.rb
+++ b/spec/factories/probes.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :probe do
trait :with_stuff do
diff --git a/spec/factories/programs.rb b/spec/factories/programs.rb
index d58955e1b..d24222d10 100644
--- a/spec/factories/programs.rb
+++ b/spec/factories/programs.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :program do
association :subject
diff --git a/spec/factories/question_samplers.rb b/spec/factories/question_samplers.rb
index 5009dba18..b55a8f433 100644
--- a/spec/factories/question_samplers.rb
+++ b/spec/factories/question_samplers.rb
@@ -1,11 +1,11 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :question_sampler do
transient do
questions { Question.none }
tags { Tag.none }
+ # rubocop:disable Performance/CollectionLiteralInLoop
count { [3, 4, 5].sample }
+ # rubocop:enable Performance/CollectionLiteralInLoop
end
initialize_with { new(questions, tags, count) }
diff --git a/spec/factories/questions.rb b/spec/factories/questions.rb
index 89f7bc0e5..294e32734 100644
--- a/spec/factories/questions.rb
+++ b/spec/factories/questions.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
-
FactoryBot.define do
- factory :question, parent: :medium, class: 'Question' do
- sort { 'Question' }
+ factory :question, parent: :medium, class: "Question" do
+ sort { "Question" }
transient do
teachable_sort { :course }
@@ -13,7 +11,7 @@
text { Faker::Lorem.question }
hint { Faker::Lorem.sentence }
level { [0, 1, 2].sample }
- question_sort { 'mc' }
+ question_sort { "mc" }
independent { true }
end
diff --git a/spec/factories/quiz_certificates.rb b/spec/factories/quiz_certificates.rb
index 2d2ed08bc..3e2977acc 100644
--- a/spec/factories/quiz_certificates.rb
+++ b/spec/factories/quiz_certificates.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :quiz_certificate do
association :quiz
diff --git a/spec/factories/quiz_graphs.rb b/spec/factories/quiz_graphs.rb
index 491a0b2d8..6cf9712f0 100644
--- a/spec/factories/quiz_graphs.rb
+++ b/spec/factories/quiz_graphs.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :quiz_graph do
trait :linear do
@@ -11,9 +9,9 @@
questions = create_list(:valid_question, evaluator.questions_count,
:with_answers)
question_list = questions.map.with_index do |question, i|
- [i + 1, { type: 'Question', id: question.id }]
+ [i + 1, { type: "Question", id: question.id }]
end
- q.vertices = Hash[question_list]
+ q.vertices = question_list.to_h
q.edges = {}
q.root = 1
q.default_table = {}
diff --git a/spec/factories/quiz_rounds.rb b/spec/factories/quiz_rounds.rb
index b5587455a..613d9c266 100644
--- a/spec/factories/quiz_rounds.rb
+++ b/spec/factories/quiz_rounds.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :quiz_round do
transient do
diff --git a/spec/factories/quizzes.rb b/spec/factories/quizzes.rb
index 2c1bf05e2..16e1ec2eb 100644
--- a/spec/factories/quizzes.rb
+++ b/spec/factories/quizzes.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
-
FactoryBot.define do
- factory :quiz, parent: :medium, class: 'Quiz' do
- sort { 'Quiz' }
+ factory :quiz, parent: :medium, class: "Quiz" do
+ sort { "Quiz" }
transient do
teachable_sort { :course }
@@ -20,7 +18,7 @@
:with_teachable]
factory :valid_random_quiz, traits: [:with_description] do
- sort { 'RandomQuiz' }
+ sort { "RandomQuiz" }
end
end
end
diff --git a/spec/factories/readers.rb b/spec/factories/readers.rb
index dacbec968..b62d1e061 100644
--- a/spec/factories/readers.rb
+++ b/spec/factories/readers.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :reader do
association :user, factory: :confirmed_user
diff --git a/spec/factories/referrals.rb b/spec/factories/referrals.rb
index 19e0bb11e..764f0f089 100644
--- a/spec/factories/referrals.rb
+++ b/spec/factories/referrals.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :referral do
association :item
diff --git a/spec/factories/relations.rb b/spec/factories/relations.rb
index 288485f9f..956666615 100644
--- a/spec/factories/relations.rb
+++ b/spec/factories/relations.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :relation do
association :tag
diff --git a/spec/factories/remarks.rb b/spec/factories/remarks.rb
index 36231b4ed..aea87168a 100644
--- a/spec/factories/remarks.rb
+++ b/spec/factories/remarks.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
-
FactoryBot.define do
- factory :remark, parent: :medium, class: 'Remark' do
- sort { 'Remark' }
+ factory :remark, parent: :medium, class: "Remark" do
+ sort { "Remark" }
transient do
teachable_sort { :course }
diff --git a/spec/factories/section_tag_joins.rb b/spec/factories/section_tag_joins.rb
index 255136c93..a47e73659 100644
--- a/spec/factories/section_tag_joins.rb
+++ b/spec/factories/section_tag_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :section_tag_join do
association :tag
diff --git a/spec/factories/sections.rb b/spec/factories/sections.rb
index 1c3a08be4..6e1232675 100644
--- a/spec/factories/sections.rb
+++ b/spec/factories/sections.rb
@@ -1,10 +1,8 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :section do
association :chapter
title do
- Faker::Book.title + ' ' + Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
end
end
diff --git a/spec/factories/solutions.rb b/spec/factories/solutions.rb
index 2be1fe54a..80aa4cd7c 100644
--- a/spec/factories/solutions.rb
+++ b/spec/factories/solutions.rb
@@ -1,10 +1,10 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :solution do
transient do
sort do
+ # rubocop:disable Performance/CollectionLiteralInLoop
[:mampf_expression, :mampf_matrix, :mampf_tuple, :mampf_set].sample
+ # rubocop:enable Performance/CollectionLiteralInLoop
end
content { build(sort) }
end
diff --git a/spec/factories/subjects.rb b/spec/factories/subjects.rb
index ee5e87f16..a61a73af2 100644
--- a/spec/factories/subjects.rb
+++ b/spec/factories/subjects.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :subject do
name { Faker::IndustrySegments.super_sector }
diff --git a/spec/factories/submission_cleaner.rb b/spec/factories/submission_cleaner.rb
index 7c3653d82..965b15773 100644
--- a/spec/factories/submission_cleaner.rb
+++ b/spec/factories/submission_cleaner.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :submission_cleaner do
transient do
@@ -10,4 +8,4 @@
new(date: date)
end
end
-end
\ No newline at end of file
+end
diff --git a/spec/factories/submissions.rb b/spec/factories/submissions.rb
index 3aface3e6..b1aaa1ea1 100644
--- a/spec/factories/submissions.rb
+++ b/spec/factories/submissions.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :submission do
transient do
@@ -23,13 +21,13 @@
trait :with_manuscript do
after(:build) do |s|
- s.manuscript = File.open("#{SPEC_FILES}/manuscript.pdf", 'rb')
+ s.manuscript = File.open("#{SPEC_FILES}/manuscript.pdf", "rb")
end
end
trait :with_correction do
after(:build) do |s|
- s.correction = File.open("#{SPEC_FILES}/manuscript.pdf", 'rb')
+ s.correction = File.open("#{SPEC_FILES}/manuscript.pdf", "rb")
end
end
diff --git a/spec/factories/tags.rb b/spec/factories/tags.rb
index fc21359ca..8aa9445df 100644
--- a/spec/factories/tags.rb
+++ b/spec/factories/tags.rb
@@ -1,6 +1,4 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :tag, aliases: [:related_tag] do
@@ -9,7 +7,7 @@
related_tags_count { 2 }
courses_count { 2 }
title do
- Faker::Book.title + ' ' + Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
end
diff --git a/spec/factories/talks.rb b/spec/factories/talks.rb
index 70eb1f8b4..9b77103a7 100644
--- a/spec/factories/talks.rb
+++ b/spec/factories/talks.rb
@@ -1,6 +1,4 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :talk do
@@ -12,7 +10,7 @@
# factory
title do
- Faker::Book.title + ' ' + Faker::Number.between(from: 1, to: 9999).to_s
+ "#{Faker::Book.title} #{Faker::Number.between(from: 1, to: 9999)}"
end
trait :with_seminar do
@@ -20,8 +18,8 @@
end
trait :with_date
- dates do
- [ Faker::Date.in_date_period ]
+ dates do
+ [Faker::Date.in_date_period]
end
trait :with_speaker do
@@ -35,4 +33,4 @@
factory :valid_talk_with_speaker, traits: [:with_seminar, :with_speaker]
end
-end
\ No newline at end of file
+end
diff --git a/spec/factories/teachable_parsers.rb b/spec/factories/teachable_parsers.rb
index 5d9959bb4..ffe226871 100644
--- a/spec/factories/teachable_parsers.rb
+++ b/spec/factories/teachable_parsers.rb
@@ -1,10 +1,8 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :teachable_parser do
transient do
all_teachables { nil }
- teachable_ids { ['Course-1', 'Lecture-2', 'Lecture-3'] }
+ teachable_ids { ["Course-1", "Lecture-2", "Lecture-3"] }
teachable_inheritance { [true, false].sample }
end
diff --git a/spec/factories/terms.rb b/spec/factories/terms.rb
index 2ecd658f2..9a1c6e949 100644
--- a/spec/factories/terms.rb
+++ b/spec/factories/terms.rb
@@ -1,14 +1,12 @@
-# frozen_string_literal: true
-
-require 'faker'
+require "faker"
FactoryBot.define do
factory :term do
- season { ['WS', 'SS'].sample }
+ season { ["WS", "SS"].sample }
year { Faker::Number.between(from: 2000, to: 100_000) }
trait :summer do
- season { 'SS' }
+ season { "SS" }
end
end
end
diff --git a/spec/factories/time_stamp.rb b/spec/factories/time_stamp.rb
index 86b4e1d4a..00775a377 100644
--- a/spec/factories/time_stamp.rb
+++ b/spec/factories/time_stamp.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :time_stamp do
transient do
@@ -12,7 +10,7 @@
# FactoryBot.build(:time_stamp_by_string, time_string: '1:17:29.745')
factory :time_stamp_by_string do
transient do
- time_string { '0:00:00.000' }
+ time_string { "0:00:00.000" }
end
initialize_with { new(time_string: time_string) }
end
diff --git a/spec/factories/tutor_tutorial_joins.rb b/spec/factories/tutor_tutorial_joins.rb
index 019740bbb..aa9555033 100644
--- a/spec/factories/tutor_tutorial_joins.rb
+++ b/spec/factories/tutor_tutorial_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :tutor_tutorial_join do
association :tutorial
diff --git a/spec/factories/tutorials.rb b/spec/factories/tutorials.rb
index 00babe017..38f3ea97f 100644
--- a/spec/factories/tutorials.rb
+++ b/spec/factories/tutorials.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :tutorial do
association :lecture
- title { Faker::Movie.title + ' ' + Faker::Number.number.to_s }
+ title { "#{Faker::Movie.title} #{Faker::Number.number}" }
end
trait :with_tutors do
diff --git a/spec/factories/user_favorite_lecture_joins.rb b/spec/factories/user_favorite_lecture_joins.rb
index b602efe14..037b40f3c 100644
--- a/spec/factories/user_favorite_lecture_joins.rb
+++ b/spec/factories/user_favorite_lecture_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :user_favorite_lecture_join do
association :user, factory: :confirmed_user
diff --git a/spec/factories/user_submission_joins.rb b/spec/factories/user_submission_joins.rb
index 683524a7e..64a7622cc 100644
--- a/spec/factories/user_submission_joins.rb
+++ b/spec/factories/user_submission_joins.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :user_submission_join do
association :user
diff --git a/spec/factories/users.rb b/spec/factories/users.rb
index bbf7a3837..c4b8dbbc7 100644
--- a/spec/factories/users.rb
+++ b/spec/factories/users.rb
@@ -1,5 +1,3 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :user, aliases: [:teacher] do
email { Faker::Internet.email }
@@ -21,7 +19,7 @@
trait :consented do
after(:create) do |user|
- user.update(consents: true, consented_at: Time.now)
+ user.update(consents: true, consented_at: Time.zone.now)
end
end
diff --git a/spec/factories/vtt_containers.rb b/spec/factories/vtt_containers.rb
index dca1a9756..087864e58 100644
--- a/spec/factories/vtt_containers.rb
+++ b/spec/factories/vtt_containers.rb
@@ -1,16 +1,14 @@
-# frozen_string_literal: true
-
FactoryBot.define do
factory :vtt_container do
trait :with_table_of_contents do
after(:build) do |v|
- v.table_of_contents = File.open("#{SPEC_FILES}/toc.vtt", 'rb')
+ v.table_of_contents = File.open("#{SPEC_FILES}/toc.vtt", "rb")
end
end
trait :with_references do
after(:build) do |v|
- v.references = File.open("#{SPEC_FILES}/references.vtt", 'rb')
+ v.references = File.open("#{SPEC_FILES}/references.vtt", "rb")
end
end
end
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index cb793490d..8d6f554e1 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe ApplicationHelper, type: :helper do
+RSpec.describe(ApplicationHelper, type: :helper) do
# NEEDS TO BE REFACTORED
# describe '#full_title' do
diff --git a/spec/mailers/notification_mailer_spec.rb b/spec/mailers/notification_mailer_spec.rb
index 4f4e66b85..4178dbeeb 100644
--- a/spec/mailers/notification_mailer_spec.rb
+++ b/spec/mailers/notification_mailer_spec.rb
@@ -1,7 +1,5 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe NotificationMailer, type: :mailer do
+RSpec.describe(NotificationMailer, type: :mailer) do
# NEEDS TO BE ADDED
end
diff --git a/spec/models/announcement_spec.rb b/spec/models/announcement_spec.rb
index 90de992e4..7d5112ae3 100644
--- a/spec/models/announcement_spec.rb
+++ b/spec/models/announcement_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Announcement, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Announcement, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:announcement)).to be_valid
end
# test validations
- it 'is invalid without details' do
+ it "is invalid without details" do
announcement = FactoryBot.build(:announcement)
announcement.details = nil
expect(announcement).to be_invalid
@@ -17,18 +15,18 @@
# test traits
- describe 'with lecture' do
+ describe "with lecture" do
before :all do
@announcement = FactoryBot.build(:announcement, :with_lecture)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@announcement).to be_valid
end
- it 'has a lecture' do
+ it "has a lecture" do
expect(@announcement.lecture).to be_kind_of(Lecture)
end
- it 'has the lectures teacher as announcer' do
- expect(@announcement.announcer).to eq @announcement.lecture.teacher
+ it "has the lectures teacher as announcer" do
+ expect(@announcement.announcer).to eq(@announcement.lecture.teacher)
end
end
diff --git a/spec/models/answer_spec.rb b/spec/models/answer_spec.rb
index abe7030ad..b8211e4e5 100644
--- a/spec/models/answer_spec.rb
+++ b/spec/models/answer_spec.rb
@@ -1,14 +1,12 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Answer, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Answer, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_answer)).to be_valid
end
# test validations
- it 'is invalid without a question' do
+ it "is invalid without a question" do
answer = FactoryBot.build(:valid_answer)
answer.question = nil
expect(answer).to be_invalid
@@ -16,17 +14,17 @@
# test traits
- describe 'with stuff' do
+ describe "with stuff" do
before :all do
@answer = FactoryBot.build(:answer, :with_stuff)
end
- it 'has a text' do
+ it "has a text" do
expect(@answer.text).to be_truthy
end
- it 'has a value' do
+ it "has a value" do
expect(@answer.value).to be_in([true, false])
end
- it 'has an explanation' do
+ it "has an explanation" do
expect(@answer.explanation).to be_truthy
end
end
diff --git a/spec/models/assignment_spec.rb b/spec/models/assignment_spec.rb
index d4ca822a8..261b61ba1 100644
--- a/spec/models/assignment_spec.rb
+++ b/spec/models/assignment_spec.rb
@@ -1,40 +1,38 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Assignment, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Assignment, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_assignment)).to be_valid
end
# test validations
- it 'is invalid without a deadline' do
+ it "is invalid without a deadline" do
assignment = FactoryBot.build(:valid_assignment, deadline: nil)
expect(assignment).to be_invalid
end
- it 'is invalid without a title' do
+ it "is invalid without a title" do
assignment = FactoryBot.build(:valid_assignment, title: nil)
expect(assignment).to be_invalid
end
- it 'is invalid with duplicate title in same lecture' do
- assignment = FactoryBot.create(:valid_assignment, title: 'usual BS')
+ it "is invalid with duplicate title in same lecture" do
+ assignment = FactoryBot.create(:valid_assignment, title: "usual BS")
lecture = assignment.lecture
new_assignment = FactoryBot.build(:valid_assignment, lecture: lecture,
- title: 'usual BS')
+ title: "usual BS")
expect(new_assignment).to be_invalid
end
- it 'is invalid with inadmissible accepted filetype' do
- assignment = FactoryBot.build(:valid_assignment, accepted_file_type: '.jpg')
+ it "is invalid with inadmissible accepted filetype" do
+ assignment = FactoryBot.build(:valid_assignment, accepted_file_type: ".jpg")
expect(assignment).to be_invalid
end
# test traits
- describe 'with lecture' do
- it 'has a lecture' do
+ describe "with lecture" do
+ it "has a lecture" do
assignment = FactoryBot.build(:assignment, :with_lecture)
expect(assignment.lecture).to be_kind_of(Lecture)
end
diff --git a/spec/models/chapter_spec.rb b/spec/models/chapter_spec.rb
index ba93b1757..af3a1a262 100644
--- a/spec/models/chapter_spec.rb
+++ b/spec/models/chapter_spec.rb
@@ -1,34 +1,32 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Chapter, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Chapter, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:chapter)).to be_valid
end
# test validations
- it 'is invalid without a title' do
+ it "is invalid without a title" do
chapter = FactoryBot.build(:chapter, title: nil)
expect(chapter).to be_invalid
end
# test traits
- describe 'chapter with sections' do
+ describe "chapter with sections" do
before :all do
@chapter = FactoryBot.build(:chapter, :with_sections)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@chapter).to be_valid
end
- it 'has 3 sections when called without section_count parameter' do
- expect(@chapter.sections.size).to eq 3
+ it "has 3 sections when called without section_count parameter" do
+ expect(@chapter.sections.size).to eq(3)
end
- it 'has the correct number of sections' do
+ it "has the correct number of sections" do
chapter = FactoryBot.build(:chapter, :with_sections, section_count: 5)
- expect(chapter.sections.size).to eq 5
+ expect(chapter.sections.size).to eq(5)
end
end
diff --git a/spec/models/clicker_spec.rb b/spec/models/clicker_spec.rb
index df6834ea3..ddbc57f07 100644
--- a/spec/models/clicker_spec.rb
+++ b/spec/models/clicker_spec.rb
@@ -1,54 +1,52 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Clicker, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Clicker, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_clicker)).to be_valid
end
# test validations
- it 'is invalid without a title' do
+ it "is invalid without a title" do
clicker = FactoryBot.build(:valid_clicker, title: nil)
expect(clicker).to be_invalid
end
- it 'is invalid with duplicate title for same editor' do
- clicker = FactoryBot.create(:valid_clicker, title: 'usual BS')
+ it "is invalid with duplicate title for same editor" do
+ clicker = FactoryBot.create(:valid_clicker, title: "usual BS")
editor = clicker.editor
new_clicker = FactoryBot.build(:valid_clicker, editor: editor,
- title: 'usual BS')
+ title: "usual BS")
expect(new_clicker).to be_invalid
end
# test traits and subfactories
- describe 'with editor' do
- it 'has an editor' do
+ describe "with editor" do
+ it "has an editor" do
clicker = FactoryBot.build(:clicker, :with_editor)
expect(clicker.editor).to be_kind_of(User)
end
end
- describe 'with question' do
- it 'has a question' do
+ describe "with question" do
+ it "has a question" do
clicker = FactoryBot.build(:clicker, :with_question)
expect(clicker.question).to be_kind_of(Question)
end
end
- describe 'open' do
- it 'is open' do
+ describe "open" do
+ it "is open" do
clicker = FactoryBot.build(:clicker, :open)
- expect(clicker.open).to be true
+ expect(clicker.open).to be(true)
end
end
- describe 'with modified alternatives' do
- it 'has the correct amount of alternatives' do
+ describe "with modified alternatives" do
+ it "has the correct amount of alternatives" do
clicker = FactoryBot.create(:valid_clicker, :with_modified_alternatives,
alternative_count: 5)
- expect(clicker.alternatives).to eq 5
+ expect(clicker.alternatives).to eq(5)
end
end
diff --git a/spec/models/clicker_vote_spec.rb b/spec/models/clicker_vote_spec.rb
index 7cbca98aa..779d0f4ed 100644
--- a/spec/models/clicker_vote_spec.rb
+++ b/spec/models/clicker_vote_spec.rb
@@ -1,21 +1,19 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe ClickerVote, type: :model do
- it 'has a valid factory' do
+RSpec.describe(ClickerVote, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_clicker_vote)).to be_valid
end
# test validations
- it 'is invalid if clicker is not open' do
+ it "is invalid if clicker is not open" do
vote = FactoryBot.build(:valid_clicker_vote)
vote.clicker.open = false
expect(vote).to be_invalid
end
- it 'is invalid if value is out of range' do
+ it "is invalid if value is out of range" do
vote = FactoryBot.build(:valid_clicker_vote, value: 5)
expect(vote).to be_invalid
end
diff --git a/spec/models/consumption_spec.rb b/spec/models/consumption_spec.rb
index a5215acb2..698776175 100644
--- a/spec/models/consumption_spec.rb
+++ b/spec/models/consumption_spec.rb
@@ -1,35 +1,33 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Consumption, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Consumption, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:consumption)).to be_valid
end
# describe traits
- describe 'with stuff' do
+ describe "with stuff" do
before :all do
@consumption = FactoryBot.build(:consumption, :with_stuff)
end
- it 'has a medium id' do
+ it "has a medium id" do
expect(@consumption.medium_id).to be_kind_of(Integer)
end
- it 'has a sort' do
+ it "has a sort" do
expect(@consumption.sort).to be_truthy
end
- it 'has a mode' do
+ it "has a mode" do
expect(@consumption.mode).to be_truthy
end
- it 'has the correct mode for videos' do
- consumption = FactoryBot.build(:consumption, :with_stuff, sort: 'video')
- expect(consumption.mode.in?(['thyme', 'download'])).to be true
+ it "has the correct mode for videos" do
+ consumption = FactoryBot.build(:consumption, :with_stuff, sort: "video")
+ expect(consumption.mode.in?(["thyme", "download"])).to be(true)
end
- it 'has the correct mode for manuscripts' do
+ it "has the correct mode for manuscripts" do
consumption = FactoryBot.build(:consumption, :with_stuff,
- sort: 'manuscript')
- expect(consumption.mode.in?(['pdf_view', 'download'])).to be true
+ sort: "manuscript")
+ expect(consumption.mode.in?(["pdf_view", "download"])).to be(true)
end
end
end
diff --git a/spec/models/course_self_join_spec.rb b/spec/models/course_self_join_spec.rb
index 0710cc940..71e6059b0 100644
--- a/spec/models/course_self_join_spec.rb
+++ b/spec/models/course_self_join_spec.rb
@@ -1,24 +1,22 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe CourseSelfJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(CourseSelfJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:course_self_join)).to be_valid
end
# test validations
- it 'is invalid without a course' do
+ it "is invalid without a course" do
expect(FactoryBot.build(:course_self_join, course: nil)).to be_invalid
end
- it 'is invalid without a preceding course' do
+ it "is invalid without a preceding course" do
expect(FactoryBot.build(:course_self_join, preceding_course: nil))
.to be_invalid
end
- it 'is invalid with a duplicate preceding course' do
+ it "is invalid with a duplicate preceding course" do
course_join = FactoryBot.create(:course_self_join)
course = course_join.course
preceding_course = course_join.preceding_course
diff --git a/spec/models/course_spec.rb b/spec/models/course_spec.rb
index a18fb6d0f..46165b833 100644
--- a/spec/models/course_spec.rb
+++ b/spec/models/course_spec.rb
@@ -1,96 +1,94 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Course, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Course, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:course)).to be_valid
end
# Test validations
- it 'is invalid without a title' do
+ it "is invalid without a title" do
course = FactoryBot.build(:course, title: nil)
expect(course).to be_invalid
end
- it 'is invalid with a duplicate title' do
- FactoryBot.create(:course, title: 'usual bs')
- course = FactoryBot.build(:course, title: 'usual bs')
+ it "is invalid with a duplicate title" do
+ FactoryBot.create(:course, title: "usual bs")
+ course = FactoryBot.build(:course, title: "usual bs")
expect(course).to be_invalid
end
- it 'is invalid without a short title' do
+ it "is invalid without a short title" do
course = FactoryBot.build(:course, short_title: nil)
expect(course).to be_invalid
end
- it 'is invalid with a duplicate short title' do
- FactoryBot.create(:course, short_title: 'usual bs')
- course = FactoryBot.build(:course, short_title: 'usual bs')
+ it "is invalid with a duplicate short title" do
+ FactoryBot.create(:course, short_title: "usual bs")
+ course = FactoryBot.build(:course, short_title: "usual bs")
expect(course).to be_invalid
end
# Test traits
- describe 'course with tags' do
+ describe "course with tags" do
before :all do
@course = FactoryBot.build(:course, :with_tags)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@course).to be_valid
end
- it 'has tags' do
+ it "has tags" do
expect(@course.tags).not_to be_nil
end
- it 'has 3 tags when called without tag_count parameter' do
- expect(@course.tags.size).to eq 3
+ it "has 3 tags when called without tag_count parameter" do
+ expect(@course.tags.size).to eq(3)
end
- it 'has the correct number of tags when called with tag_count parameter' do
+ it "has the correct number of tags when called with tag_count parameter" do
course = FactoryBot.build(:course, :with_tags, tag_count: 5)
- expect(course.tags.size).to eq 5
+ expect(course.tags.size).to eq(5)
end
end
- describe 'term independent course' do
+ describe "term independent course" do
course = FactoryBot.build(:course, :term_independent)
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(course).to be_valid
end
- it 'is term independent' do
- expect(course.term_independent).to be true
+ it "is term independent" do
+ expect(course.term_independent).to be(true)
end
end
- describe 'course with organizational stuff' do
+ describe "course with organizational stuff" do
course = FactoryBot.build(:course, :with_organizational_stuff)
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(course).to be_valid
end
- it 'has organzational flag set to true' do
- expect(course.organizational).to be true
+ it "has organzational flag set to true" do
+ expect(course.organizational).to be(true)
end
- it 'has an organizational concept' do
+ it "has an organizational concept" do
expect(course.organizational_concept).to be_truthy
end
end
- describe 'course with locale de' do
+ describe "course with locale de" do
course = FactoryBot.build(:course, :locale_de)
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(course).to be_valid
end
- it 'has locale de' do
- expect(course.locale).to eq 'de'
+ it "has locale de" do
+ expect(course.locale).to eq("de")
end
end
- describe 'with image' do
- it 'has an image' do
+ describe "with image" do
+ it "has an image" do
course = FactoryBot.build(:course, :with_image)
expect(course.image).to be_kind_of(ScreenshotUploader::UploadedFile)
end
end
- describe 'with image and normalization' do
- it 'has a normalized image' do
+ describe "with image and normalization" do
+ it "has a normalized image" do
course = FactoryBot.build(:course, :with_image_and_normalization)
expect(course.image(:normalized))
.to be_kind_of(ScreenshotUploader::UploadedFile)
@@ -99,14 +97,14 @@
# test callbacks
- describe 'after save' do
+ describe "after save" do
before :all do
@course = FactoryBot.create(:course)
@lecture = FactoryBot.create(:lecture_with_sparse_toc, course: @course)
@lesson = FactoryBot.create(:valid_lesson, lecture: @lecture)
end
- it 'touches all media related to the course (with inheritance)' do
+ it "touches all media related to the course (with inheritance)" do
course_medium = FactoryBot.create(:course_medium, teachable: @course)
lecture_medium = FactoryBot.create(:lecture_medium, teachable: @lecture)
lesson_medium = FactoryBot.create(:lesson_medium, teachable: @lecture)
@@ -119,22 +117,22 @@
new_updated_ats = [course_medium.updated_at, lecture_medium.updated_at,
lesson_medium.updated_at]
comparison = [0, 1, 2].map { |i| updated_ats[i] == new_updated_ats[i] }
- expect(comparison).to eq [false, false, false]
+ expect(comparison).to eq([false, false, false])
end
- it 'touches all lectures and lessons related to the course' do
+ it "touches all lectures and lessons related to the course" do
updated_ats = [@lecture.updated_at, @lesson.updated_at]
@course.save
@lecture.reload
@lesson.reload
new_updated_ats = [@lecture.updated_at, @lesson.updated_at]
comparison = [0, 1].map { |i| updated_ats[i] == new_updated_ats[i] }
- expect(comparison).to eq [false, false]
+ expect(comparison).to eq([false, false])
end
end
- describe 'after adding of a tag' do
- it 'touches the added tag' do
+ describe "after adding of a tag" do
+ it "touches the added tag" do
course = FactoryBot.create(:course)
tag = FactoryBot.create(:tag)
tag_update = tag.updated_at
@@ -145,8 +143,8 @@
end
end
- describe 'after removing of a tag' do
- it 'touches the removed tag' do
+ describe "after removing of a tag" do
+ it "touches the removed tag" do
course = FactoryBot.create(:course)
tag = FactoryBot.create(:tag)
course.tags << tag
@@ -160,131 +158,131 @@
end
# Test methods
- describe '#course' do
- it 'returns self' do
+ describe "#course" do
+ it "returns self" do
course = FactoryBot.build(:course)
- expect(course.course).to eq course
+ expect(course.course).to eq(course)
end
end
- describe '#lecture' do
- it 'returns nil' do
+ describe "#lecture" do
+ it "returns nil" do
course = FactoryBot.build(:course)
expect(course.lecture).to be_nil
end
end
- describe '#lesson' do
- it 'returns nil' do
+ describe "#lesson" do
+ it "returns nil" do
course = FactoryBot.build(:course)
expect(course.lesson).to be_nil
end
end
- describe '#media_scope' do
- it 'returns self' do
+ describe "#media_scope" do
+ it "returns self" do
course = FactoryBot.build(:course)
- expect(course.media_scope).to eq course
+ expect(course.media_scope).to eq(course)
end
end
- describe '#selector_value' do
- it 'returns the correct selector value' do
+ describe "#selector_value" do
+ it "returns the correct selector value" do
course = FactoryBot.create(:course)
- expect(course.selector_value).to eq "Course-#{course.id}"
+ expect(course.selector_value).to eq("Course-#{course.id}")
end
end
- describe '#to_label' do
- it 'returns the correct label' do
- course = FactoryBot.build(:course, title: 'usual bs')
- expect(course.to_label).to eq('usual bs')
+ describe "#to_label" do
+ it "returns the correct label" do
+ course = FactoryBot.build(:course, title: "usual bs")
+ expect(course.to_label).to eq("usual bs")
end
end
- describe '#compact_title' do
- it 'returns the correct compact title' do
- course = FactoryBot.build(:course, short_title: 'BS')
- expect(course.compact_title).to eq('BS')
+ describe "#compact_title" do
+ it "returns the correct compact title" do
+ course = FactoryBot.build(:course, short_title: "BS")
+ expect(course.compact_title).to eq("BS")
end
end
- describe '#title_for_viewers' do
- it 'returns the correct title for viewers' do
- course = FactoryBot.build(:course, short_title: 'BS')
- expect(course.title_for_viewers).to eq('BS')
+ describe "#title_for_viewers" do
+ it "returns the correct title for viewers" do
+ course = FactoryBot.build(:course, short_title: "BS")
+ expect(course.title_for_viewers).to eq("BS")
end
end
- describe '#long_title' do
- it 'returns the correct long title' do
- course = FactoryBot.build(:course, title: 'usual BS')
- expect(course.long_title).to eq('usual BS')
+ describe "#long_title" do
+ it "returns the correct long title" do
+ course = FactoryBot.build(:course, title: "usual BS")
+ expect(course.long_title).to eq("usual BS")
end
end
- describe '#title_no_term' do
- it 'returns the correct title' do
- course = FactoryBot.build(:course, title: 'usual BS')
- expect(course.title_no_term).to eq('usual BS')
+ describe "#title_no_term" do
+ it "returns the correct title" do
+ course = FactoryBot.build(:course, title: "usual BS")
+ expect(course.title_no_term).to eq("usual BS")
end
end
- describe '#locale_with_inheritance' do
- it 'returns the correct locale' do
- course = FactoryBot.build(:course, locale: 'br')
- expect(course.locale_with_inheritance).to eq('br')
+ describe "#locale_with_inheritance" do
+ it "returns the correct locale" do
+ course = FactoryBot.build(:course, locale: "br")
+ expect(course.locale_with_inheritance).to eq("br")
end
end
- describe '#card_header' do
- it 'returns the correct card header' do
- course = FactoryBot.build(:course, title: 'usual BS')
- expect(course.card_header).to eq('usual BS')
+ describe "#card_header" do
+ it "returns the correct card header" do
+ course = FactoryBot.build(:course, title: "usual BS")
+ expect(course.card_header).to eq("usual BS")
end
end
- describe '#published?' do
- it 'returns true' do
- course = FactoryBot.build(:course, title: 'usual BS')
- expect(course.published?).to be true
+ describe "#published?" do
+ it "returns true" do
+ course = FactoryBot.build(:course, title: "usual BS")
+ expect(course.published?).to be(true)
end
end
- describe '#card_header_path' do
- it 'returns nil' do
+ describe "#card_header_path" do
+ it "returns nil" do
course = FactoryBot.build(:course)
user = FactoryBot.build(:confirmed_user)
expect(course.card_header_path(user)).to be_nil
end
end
- describe '#irrelevant?' do
+ describe "#irrelevant?" do
before :each do
@course = FactoryBot.build(:course)
end
- it 'returns false if the course has lectures' do
+ it "returns false if the course has lectures" do
FactoryBot.build(:lecture, course: @course)
- expect(@course.irrelevant?).to be false
+ expect(@course.irrelevant?).to be(false)
end
- it 'returns false if the course has media' do
+ it "returns false if the course has media" do
FactoryBot.build(:course_medium, teachable: @course)
- expect(@course.irrelevant?).to be false
+ expect(@course.irrelevant?).to be(false)
end
- it 'returns false if the course is not persisted' do
- expect(@course.irrelevant?).to be false
+ it "returns false if the course is not persisted" do
+ expect(@course.irrelevant?).to be(false)
end
- it 'returns true if the course is persisted and has no lectures or media' do
+ it "returns true if the course is persisted and has no lectures or media" do
@course.save
- expect(@course.irrelevant?).to be true
+ expect(@course.irrelevant?).to be(true)
end
end
- context 'subscribable lectures' do
+ context "subscribable lectures" do
before :all do
@admin = FactoryBot.create(:confirmed_user, admin: true)
@course_editor = FactoryBot.create(:confirmed_user)
@@ -293,8 +291,8 @@
@generic_user = FactoryBot.create(:confirmed_user)
@course = FactoryBot.create(:course, editors: [@course_editor])
year = Faker::Number.between(from: 1_000_001, to: 100_000_000)
- term1 = FactoryBot.create(:term, year: year, season: 'SS')
- term2 = FactoryBot.create(:term, year: year, season: 'WS')
+ term1 = FactoryBot.create(:term, year: year, season: "SS")
+ term2 = FactoryBot.create(:term, year: year, season: "WS")
term3 = FactoryBot.create(:term, year: year + 1)
term4 = FactoryBot.create(:term, year: year + 2)
@lecture1 = FactoryBot.create(:lecture, course: @course,
@@ -307,47 +305,40 @@
course: @course, term: term4)
end
- describe '#subscribable_lectures' do
- it 'returns all lectures for admins' do
+ describe "#subscribable_lectures" do
+ it "returns all lectures for admins" do
expect(@course.subscribable_lectures(@admin))
.to match_array([@lecture1, @lecture2, @lecture3, @lecture4])
end
- it 'returns all lectures for course editors' do
+ it "returns all lectures for course editors" do
expect(@course.subscribable_lectures(@course_editor))
.to match_array([@lecture1, @lecture2, @lecture3, @lecture4])
end
- it 'returns all given lectures and published lectures for teachers' do
+ it "returns all given lectures and published lectures for teachers" do
expect(@course.subscribable_lectures(@teacher))
.to match_array([@lecture1, @lecture3, @lecture4])
end
- it 'returns all edited lectures and published lectures for editors' do
+ it "returns all edited lectures and published lectures for editors" do
expect(@course.subscribable_lectures(@editor))
.to match_array([@lecture2, @lecture3, @lecture4])
end
- it 'returns all published lectures for generic users' do
+ it "returns all published lectures for generic users" do
expect(@course.subscribable_lectures(@generic_user))
.to match_array([@lecture3, @lecture4])
end
end
end
- describe '#restricted?' do
- it 'returns false' do
- course = FactoryBot.build(:course)
- expect(course.restricted?).to be false
- end
- end
-
- context 'lecture sorting' do
+ context "lecture sorting" do
before :all do
@course = FactoryBot.create(:course)
year = Faker::Number.between(from: 1_000_001, to: 100_000_000)
- term1 = FactoryBot.create(:term, year: year, season: 'SS')
- term2 = FactoryBot.create(:term, year: year, season: 'WS')
+ term1 = FactoryBot.create(:term, year: year, season: "SS")
+ term2 = FactoryBot.create(:term, year: year, season: "WS")
term3 = FactoryBot.create(:term, year: year + 1)
term4 = FactoryBot.create(:term, year: year + 2)
@lecture1 = FactoryBot.create(:lecture, :released_for_all,
@@ -358,28 +349,28 @@
@lecture4 = FactoryBot.create(:lecture, course: @course, term: term4)
end
- describe '#lectures_by_date' do
- it 'returns the lectures sorted by date' do
+ describe "#lectures_by_date" do
+ it "returns the lectures sorted by date" do
expect(@course.lectures_by_date.to_a)
.to eq([@lecture4, @lecture3, @lecture2, @lecture1])
end
end
end
- describe '#select_tags_by_title' do
- it 'returns the correct list' do
+ describe "#select_tags_by_title" do
+ it "returns the correct list" do
course = FactoryBot.create(:course)
- tag1 = FactoryBot.create(:tag, title: 'Xperience', courses: [course])
+ tag1 = FactoryBot.create(:tag, title: "Xperience", courses: [course])
id1 = tag1.id
- tag2 = FactoryBot.create(:tag, title: 'Adventure', courses: [course])
+ tag2 = FactoryBot.create(:tag, title: "Adventure", courses: [course])
id2 = tag2.id
- expect(course.select_tags_by_title).to eq [['Adventure', id2],
- ['Xperience', id1]]
+ expect(course.select_tags_by_title).to eq([["Adventure", id2],
+ ["Xperience", id1]])
end
end
- describe '#items' do
- it 'returns all items from the lectures of the course' do
+ describe "#items" do
+ it "returns all items from the lectures of the course" do
course = FactoryBot.create(:course)
lecture1 = FactoryBot.create(:lecture_with_sparse_toc, course: course)
lecture2 = FactoryBot.create(:lecture_with_sparse_toc, course: course)
@@ -391,12 +382,12 @@
end
end
- context 'lecture subscriptions' do
+ context "lecture subscriptions" do
before :all do
@course = FactoryBot.create(:course)
year = Faker::Number.between(from: 1_000_001, to: 100_000_000)
- term1 = FactoryBot.create(:term, year: year, season: 'SS')
- term2 = FactoryBot.create(:term, year: year, season: 'WS')
+ term1 = FactoryBot.create(:term, year: year, season: "SS")
+ term2 = FactoryBot.create(:term, year: year, season: "WS")
term3 = FactoryBot.create(:term, year: year + 1)
term4 = FactoryBot.create(:term, year: year + 2)
@lecture1 = FactoryBot.create(:lecture, :released_for_all,
@@ -407,61 +398,61 @@
course: @course, term: term3)
@lecture4 = FactoryBot.create(:lecture, :released_for_all,
course: @course, term: term4,
- passphrase: 'test123')
+ passphrase: "test123")
@user = FactoryBot.create(:confirmed_user,
lectures: [@lecture1, @lecture2, @lecture3])
end
- describe '#subscribed_lectures' do
- it 'returns all the subscribed lectures of the user' do
+ describe "#subscribed_lectures" do
+ it "returns all the subscribed lectures of the user" do
expect(@course.subscribed_lectures(@user))
.to match_array([@lecture1, @lecture2, @lecture3])
end
end
- describe '#to_be_authorized_lectures' do
- it 'returns all the nonsubscribed lectures of the user with passphrase' do
+ describe "#to_be_authorized_lectures" do
+ it "returns all the nonsubscribed lectures of the user with passphrase" do
expect(@course.to_be_authorized_lectures(@user))
.to match_array([@lecture4])
end
end
end
- describe '#subscribed_by?' do
+ describe "#subscribed_by?" do
before :each do
@user = FactoryBot.create(:confirmed_user)
@course = FactoryBot.create(:course)
end
- it 'returns true if a lecture of the course was subscribed by user' do
+ it "returns true if a lecture of the course was subscribed by user" do
lecture = FactoryBot.create(:lecture, course: @course)
@user.lectures << lecture
- expect(@course.subscribed_by?(@user)).to be true
+ expect(@course.subscribed_by?(@user)).to be(true)
end
- it 'returns false if no lecture of the course was subscribed by user' do
- expect(@course.subscribed_by?(@user)).to be false
+ it "returns false if no lecture of the course was subscribed by user" do
+ expect(@course.subscribed_by?(@user)).to be(false)
end
end
- describe '#edited_by?' do
+ describe "#edited_by?" do
before :all do
@user = FactoryBot.create(:confirmed_user)
end
- it 'returns true if the course is edited by user' do
+ it "returns true if the course is edited by user" do
course = FactoryBot.create(:course, editors: [@user])
- expect(course.edited_by?(@user)).to be true
+ expect(course.edited_by?(@user)).to be(true)
end
- it 'returns false if course is not edited by user' do
+ it "returns false if course is not edited by user" do
course = FactoryBot.create(:course)
- expect(course.edited_by?(@user)).to be false
+ expect(course.edited_by?(@user)).to be(false)
end
end
- describe '#users' do
- it 'returns the correct users' do
+ describe "#users" do
+ it "returns the correct users" do
course = FactoryBot.create(:course)
special_user = FactoryBot.create(:confirmed_user)
users1 = FactoryBot.create_list(:confirmed_user, 3)
@@ -474,102 +465,102 @@
end
end
- describe '#addable_by?' do
+ describe "#addable_by?" do
before :each do
@user = FactoryBot.create(:confirmed_user)
end
- it 'returns true if the course is edited by user' do
+ it "returns true if the course is edited by user" do
course = FactoryBot.create(:course, editors: [@user])
- expect(course.addable_by?(@user)).to be true
+ expect(course.addable_by?(@user)).to be(true)
end
- it 'returns true if a lecture of the course is edited by user' do
+ it "returns true if a lecture of the course is edited by user" do
course = FactoryBot.create(:course)
FactoryBot.create(:lecture, course: course, editors: [@user])
- expect(course.addable_by?(@user)).to be true
+ expect(course.addable_by?(@user)).to be(true)
end
- it 'returns true if a lecture of the course has the user as teacher' do
+ it "returns true if a lecture of the course has the user as teacher" do
course = FactoryBot.create(:course)
FactoryBot.create(:lecture, course: course, teacher: @user)
- expect(course.addable_by?(@user)).to be true
+ expect(course.addable_by?(@user)).to be(true)
end
- it 'returns false if none of the above is true' do
+ it "returns false if none of the above is true" do
course = FactoryBot.create(:course)
FactoryBot.create(:lecture, course: course)
- expect(course.addable_by?(@user)).to be false
+ expect(course.addable_by?(@user)).to be(false)
end
end
- describe '#removable_by?' do
+ describe "#removable_by?" do
before :all do
@user = FactoryBot.create(:confirmed_user)
end
- it 'returns true if the course is edited by user' do
+ it "returns true if the course is edited by user" do
course = FactoryBot.create(:course, editors: [@user])
- expect(course.removable_by?(@user)).to be true
+ expect(course.removable_by?(@user)).to be(true)
end
- it 'returns false if no lecture of the course is not edited by user' do
+ it "returns false if no lecture of the course is not edited by user" do
course = FactoryBot.create(:course)
- expect(course.removable_by?(@user)).to be false
+ expect(course.removable_by?(@user)).to be(false)
end
end
- context 'media and their items with inheritance' do
+ context "media and their items with inheritance" do
before :all do
- @course = FactoryBot.create(:course, short_title: 'LA2')
- term = FactoryBot.create(:term, year: 2020, season: 'SS')
+ @course = FactoryBot.create(:course, short_title: "LA2")
+ term = FactoryBot.create(:term, year: 2020, season: "SS")
lecture = FactoryBot.create(:lecture_with_sparse_toc, course: @course,
term: term)
lesson = FactoryBot.create(:valid_lesson, lecture: lecture)
@course_medium = FactoryBot.create(:course_medium,
teachable: @course,
- description: 'p-adische Zahlen')
+ description: "p-adische Zahlen")
@lecture_medium = FactoryBot.create(:lecture_medium,
teachable: lecture,
- description: 'Gruppenring')
+ description: "Gruppenring")
@lesson_medium = FactoryBot.create(:lesson_medium,
teachable: lesson,
- description: 'exakte Folge')
+ description: "exakte Folge")
end
- describe '#media_with_inheritance' do
- it 'returns all media form course and associated lectures, lessons' do
+ describe "#media_with_inheritance" do
+ it "returns all media form course and associated lectures, lessons" do
expect(@course.media_with_inheritance)
.to match_array([@course_medium, @lecture_medium, @lesson_medium])
end
end
- describe '#media_items_with_inheritance' do
- it 'returns all items with their title and id' do
- item1 = FactoryBot.create(:item, sort: 'remark', ref_number: '1.2',
+ describe "#media_items_with_inheritance" do
+ it "returns all items with their title and id" do
+ item1 = FactoryBot.create(:item, sort: "remark", ref_number: "1.2",
medium: @course_medium)
- item2 = FactoryBot.create(:item, sort: 'theorem', ref_number: '3.4',
+ item2 = FactoryBot.create(:item, sort: "theorem", ref_number: "3.4",
medium: @lecture_medium)
- item3 = FactoryBot.create(:item, sort: 'example', ref_number: '5.6',
+ item3 = FactoryBot.create(:item, sort: "example", ref_number: "5.6",
medium: @lesson_medium)
- self_item1 = Item.find_by(sort: 'self', medium: @course_medium)
- self_item2 = Item.find_by(sort: 'self', medium: @lecture_medium)
- self_item3 = Item.find_by(sort: 'self', medium: @lesson_medium)
+ self_item1 = Item.find_by(sort: "self", medium: @course_medium)
+ self_item2 = Item.find_by(sort: "self", medium: @lecture_medium)
+ self_item3 = Item.find_by(sort: "self", medium: @lesson_medium)
expect(@course.media_items_with_inheritance)
- .to match_array([['Bem. 1.2 ', item1.id],
- ['SS 20, Satz 3.4 ', item2.id],
- ['SS 20, Bsp. 5.6 ', item3.id],
- ['Worked Example, p-adische Zahlen',
+ .to match_array([["Bem. 1.2 ", item1.id],
+ ["SS 20, Satz 3.4 ", item2.id],
+ ["SS 20, Bsp. 5.6 ", item3.id],
+ ["Worked Example, p-adische Zahlen",
self_item1.id],
- ['SS 20, Worked Example, Gruppenring',
+ ["SS 20, Worked Example, Gruppenring",
self_item2.id],
- ['SS 20, Lektion, exakte Folge', self_item3.id]])
+ ["SS 20, Lektion, exakte Folge", self_item3.id]])
end
end
end
- describe '#sections' do
- it 'returns all sections of the associated lectures' do
+ describe "#sections" do
+ it "returns all sections of the associated lectures" do
course = FactoryBot.create(:course)
lecture1 = FactoryBot.create(:lecture, course: course)
lecture2 = FactoryBot.create(:lecture, course: course)
@@ -584,75 +575,75 @@
end
end
- context 'class methods for select forms' do
+ context "class methods for select forms" do
before :all do
Course.destroy_all
@user = FactoryBot.create(:confirmed_user)
@admin = FactoryBot.create(:confirmed_user, admin: true)
- @course1 = FactoryBot.create(:course, title: 'Lineare Algebra 2',
- short_title: 'LA2',
+ @course1 = FactoryBot.create(:course, title: "Lineare Algebra 2",
+ short_title: "LA2",
editors: [@user])
- @course2 = FactoryBot.create(:course, title: 'Analysis 2',
- short_title: 'Ana2')
- @course3 = FactoryBot.create(:course, title: 'Lineare Algebra 1',
- short_title: 'LA1',
+ @course2 = FactoryBot.create(:course, title: "Analysis 2",
+ short_title: "Ana2")
+ @course3 = FactoryBot.create(:course, title: "Lineare Algebra 1",
+ short_title: "LA1",
editors: [@user])
- @course4 = FactoryBot.create(:course, title: 'Analysis 1',
- short_title: 'Ana1')
+ @course4 = FactoryBot.create(:course, title: "Analysis 1",
+ short_title: "Ana1")
end
- describe 'self.editable_selection' do
- context 'if user is admin' do
- it 'returns all Courses encoded as strings together with their title '\
- 'for viewers, ordered by title' do
+ describe "self.editable_selection" do
+ context "if user is admin" do
+ it "returns all Courses encoded as strings together with their title " \
+ "for viewers, ordered by title" do
expect(Course.editable_selection(@admin))
- .to eq([['Ana1', "Course-#{@course4.id}"],
- ['Ana2', "Course-#{@course2.id}"],
- ['LA1', "Course-#{@course3.id}"],
- ['LA2', "Course-#{@course1.id}"]])
+ .to eq([["Ana1", "Course-#{@course4.id}"],
+ ["Ana2", "Course-#{@course2.id}"],
+ ["LA1", "Course-#{@course3.id}"],
+ ["LA2", "Course-#{@course1.id}"]])
end
end
- context 'if user is non-admin' do
- it 'returns edited Courses encoded as strings together with their '\
- 'title for viewers, ordered by title' do
+ context "if user is non-admin" do
+ it "returns edited Courses encoded as strings together with their " \
+ "title for viewers, ordered by title" do
expect(Course.editable_selection(@user))
- .to eq([['LA1', "Course-#{@course3.id}"],
- ['LA2', "Course-#{@course1.id}"]])
+ .to eq([["LA1", "Course-#{@course3.id}"],
+ ["LA2", "Course-#{@course1.id}"]])
end
end
end
- describe 'self.select_by_title' do
- it 'returns all Courses with their title and id, ordered by id' do
+ describe "self.select_by_title" do
+ it "returns all Courses with their title and id, ordered by id" do
expect(Course.select_by_title)
- .to eq([['Analysis 1', @course4.id],
- ['Analysis 2', @course2.id],
- ['Lineare Algebra 1', @course3.id],
- ['Lineare Algebra 2', @course1.id]])
+ .to eq([["Analysis 1", @course4.id],
+ ["Analysis 2", @course2.id],
+ ["Lineare Algebra 1", @course3.id],
+ ["Lineare Algebra 2", @course1.id]])
end
end
end
- describe 'questions_count' do
- it 'returns true if there are >=10 questions in the course' do
+ describe "questions_count" do
+ it "returns true if there are >=10 questions in the course" do
course = FactoryBot.create(:course)
FactoryBot.create_list(:valid_question, 10,
teachable: course,
independent: true,
- released: 'all')
- expect(course.enough_questions?).to be true
+ released: "all")
+ expect(course.enough_questions?).to be(true)
end
- it 'returns false if there are <10 questions in the course' do
+ it "returns false if there are <10 questions in the course" do
course = FactoryBot.create(:course)
FactoryBot.create_list(:valid_question, 9,
teachable: course,
independent: true,
- released: 'all')
- expect(course.enough_questions?).to be false
+ released: "all")
+ expect(course.enough_questions?).to be(false)
end
end
- context 'complex question methods' do
+ context "complex question methods" do
before :all do
@course = FactoryBot.create(:course)
@lecture1 = FactoryBot.create(:lecture, :released_for_all,
@@ -661,7 +652,7 @@
@course_questions = FactoryBot.create_list(:valid_question, 7,
teachable: @course,
independent: true,
- released: 'all')
+ released: "all")
@course_tags = []
@course_questions.each_with_index do |q, i|
tag = FactoryBot.create(:tag, title: "Course Tag #{i}")
@@ -670,11 +661,11 @@
q.tags << tag
end
FactoryBot.create(:valid_question, teachable: @course, independent: false)
- FactoryBot.create(:valid_question, teachable: @course, released: 'locked')
+ FactoryBot.create(:valid_question, teachable: @course, released: "locked")
@lecture1_questions = FactoryBot.create_list(:valid_question, 6,
teachable: @lecture1,
independent: true,
- released: 'all')
+ released: "all")
@lecture1_tags = []
@lecture1_questions.each_with_index do |q, i|
tag = FactoryBot.create(:tag, title: "Lecture Tag #{i}")
@@ -684,36 +675,36 @@
FactoryBot.create(:valid_question, teachable: @lecture1,
independent: false)
FactoryBot.create(:valid_question, teachable: @lecture1,
- released: 'locked')
+ released: "locked")
FactoryBot.create(:valid_question, teachable: @lecture1)
- @special_tag1 = FactoryBot.create(:tag, title: 'Special Tag 1')
+ @special_tag1 = FactoryBot.create(:tag, title: "Special Tag 1")
@course_questions[4].tags << @special_tag1
@lecture1_questions[1].tags << @special_tag1
@questions = Question.where(id: @course_questions.pluck(:id) +
@lecture1_questions.pluck(:id))
end
- describe '#questions_count' do
- it 'returns the correct number of questions (released, in course or '\
- 'published lectures, independent)' do
- expect(@course.questions_count).to eq 13
+ describe "#questions_count" do
+ it "returns the correct number of questions (released, in course or " \
+ "published lectures, independent)" do
+ expect(@course.questions_count).to eq(13)
end
end
- describe '#questions_w_inheritance' do
- it 'returns the correct questions' do
+ describe "#questions_w_inheritance" do
+ it "returns the correct questions" do
expect(@course.questions_w_inheritance)
.to match_array(@course_questions + @lecture1_questions)
end
end
- describe '#questions' do
- it 'returns the questions with inheritance if no tags are given' do
+ describe "#questions" do
+ it "returns the questions with inheritance if no tags are given" do
expect(@course.questions(Tag.none))
.to match_array(@course_questions + @lecture1_questions)
end
- it 'returns the questions corresponding to the tags' do
+ it "returns the questions corresponding to the tags" do
expect(@course.questions([@course_tags[4], @lecture1_tags[5],
@special_tag1]))
.to match_array([@course_questions[4], @lecture1_questions[5],
@@ -721,27 +712,27 @@
end
end
- describe '#question_count' do
- it 'returns the correct count if no tags are given' do
+ describe "#question_count" do
+ it "returns the correct count if no tags are given" do
expect(@course.question_count(Tag.none))
- .to eq 13
+ .to eq(13)
end
- it 'returns the correct count ' do
+ it "returns the correct count " do
expect(@course.question_count([@course_tags[4], @lecture1_tags[5],
@special_tag1]))
- .to eq 3
+ .to eq(3)
end
end
- describe '#question_tags' do
- it 'returns the correct tags' do
+ describe "#question_tags" do
+ it "returns the correct tags" do
expect(@course.question_tags)
.to match_array(@course_tags + @lecture1_tags + [@special_tag1])
end
end
- describe '#select_question_tags_by_title' do
- it 'returns the correct question tags as a array of hashes' do
+ describe "#select_question_tags_by_title" do
+ it "returns the correct question tags as a array of hashes" do
course_tag_list = (0..6).to_a.map do |i|
{ value: @course_tags[i].id,
text: "Course Tag #{i}" }
@@ -751,62 +742,62 @@
text: "Lecture Tag #{i}" }
end
special_tag_list = [{ value: @special_tag1.id,
- text: 'Special Tag 1' }]
+ text: "Special Tag 1" }]
expect(@course.select_question_tags_by_title)
.to eq(course_tag_list + lecture_tag_list + special_tag_list)
end
end
- describe '#create_random_quiz' do
- it 'returns a valid quiz if tags are given' do
+ describe "#create_random_quiz" do
+ it "returns a valid quiz if tags are given" do
expect(@course.create_random_quiz!(@course.tags, 5)).to be_valid
end
- it 'returns a quiz without errors if tags are given' do
+ it "returns a quiz without errors if tags are given" do
expect(@course.create_random_quiz!(@course.tags, 5).find_errors)
.to eq([])
end
- it 'returns a valid quiz if no tags are given' do
+ it "returns a valid quiz if no tags are given" do
expect(@course.create_random_quiz!([], 5)).to be_valid
end
- it 'returns a quiz without errors if no tags are given' do
+ it "returns a quiz without errors if no tags are given" do
expect(@course.create_random_quiz!([], 5).find_errors).to eq([])
end
- it 'returns a valid quiz if question_count is higher than amount of '\
- 'tagged questions' do
+ it "returns a valid quiz if question_count is higher than amount of " \
+ "tagged questions" do
expect(@course.create_random_quiz!(@course_tags, 10)).to be_valid
end
- it 'returns a quiz without errors if no tags are given' do
+ it "returns a quiz without errors if no tags are given" do
expect(@course.create_random_quiz!(@course_tags, 10).find_errors)
.to eq([])
end
- it 'has the correct number of questions (#1)' do
+ it "has the correct number of questions (#1)" do
expect(@course.create_random_quiz!(@course.tags, 5).questions_count)
- .to eq 5
+ .to eq(5)
end
- it 'has the correct number of questions (#2)' do
+ it "has the correct number of questions (#2)" do
expect(@course.create_random_quiz!(@course.tags + @lecture1_tags, 10)
.questions_count)
- .to eq 10
+ .to eq(10)
end
- it 'has the correct number of questions (#3)' do
+ it "has the correct number of questions (#3)" do
expect(@course.create_random_quiz!(@course.tags, 3).questions_count)
- .to eq 5
+ .to eq(5)
end
- it 'has the correct number of questions (#4)' do
+ it "has the correct number of questions (#4)" do
expect(@course.create_random_quiz!(@course.tags, 10).questions_count)
- .to eq 7
+ .to eq(7)
end
- it 'has questions that relate to the given tags' do
+ it "has questions that relate to the given tags" do
tags = [@course_tags[0], @course_tags[2], @course_tags[4],
@course_tags[5], @lecture1_tags[2], @lecture1_tags[3],
@special_tag1]
@@ -820,124 +811,124 @@
end
end
- context 'image methods' do
+ context "image methods" do
before :all do
@course = FactoryBot.create(:course, :with_image)
end
- describe '#image_url_with_host' do
- it 'returns nil if there is no image' do
+ describe "#image_url_with_host" do
+ it "returns nil if there is no image" do
course = FactoryBot.create(:course)
expect(course.image_url_with_host).to be_nil
end
- it 'returns a string with the correct ending' do
+ it "returns a string with the correct ending" do
course = FactoryBot.create(:course, :with_image)
- expect(course.image_url_with_host.end_with?(course.image.id)).to be true
+ expect(course.image_url_with_host.end_with?(course.image.id)).to be(true)
end
end
- describe '#normalized_image_url_with_host' do
- it 'returns nil if there is no image' do
+ describe "#normalized_image_url_with_host" do
+ it "returns nil if there is no image" do
course = FactoryBot.create(:course)
expect(course.normalized_image_url_with_host).to be_nil
end
- it 'returns nil if there is no normalized image' do
+ it "returns nil if there is no normalized image" do
course = FactoryBot.create(:course, :with_image)
expect(course.normalized_image_url_with_host).to be_nil
end
- it 'returns a string with the correct ending' do
+ it "returns a string with the correct ending" do
course = FactoryBot.create(:course, :with_image_and_normalization)
expect(course.normalized_image_url_with_host
- .end_with?(course.image(:normalized).id)).to be true
+ .end_with?(course.image(:normalized).id)).to be(true)
end
end
- describe '#image_filename' do
- it 'returns nil if there is no image' do
+ describe "#image_filename" do
+ it "returns nil if there is no image" do
course = FactoryBot.create(:course)
expect(course.image_filename).to be_nil
end
- it 'returns the correct file name' do
+ it "returns the correct file name" do
course = FactoryBot.create(:course, :with_image)
- expect(course.image_filename).to eq 'image.png'
+ expect(course.image_filename).to eq("image.png")
end
end
- describe '#image_size' do
- it 'returns nil if there is no image' do
+ describe "#image_size" do
+ it "returns nil if there is no image" do
course = FactoryBot.create(:course)
expect(course.image_size).to be_nil
end
- it 'returns the correct image file size' do
+ it "returns the correct image file size" do
course = FactoryBot.create(:course, :with_image)
- expect(course.image_size).to eq 71_933
+ expect(course.image_size).to eq(71_933)
end
end
- describe '#image_resolution' do
- it 'returns nil if there is no image' do
+ describe "#image_resolution" do
+ it "returns nil if there is no image" do
course = FactoryBot.create(:course)
expect(course.image_resolution).to be_nil
end
- it 'returns the correct image resolution' do
+ it "returns the correct image resolution" do
course = FactoryBot.create(:course, :with_image)
- expect(course.image_resolution).to eq '900x600'
+ expect(course.image_resolution).to eq("900x600")
end
end
end
- describe 'self.similar_courses' do
+ describe "self.similar_courses" do
before :all do
Course.destroy_all
- @course1 = FactoryBot.create(:course, title: 'Algebra 1')
- @course2 = FactoryBot.create(:course, title: 'Algebra 2')
- @course3 = FactoryBot.create(:course, title: 'Analysis 1')
- @course3 = FactoryBot.create(:course, title: 'Analysis 2')
+ @course1 = FactoryBot.create(:course, title: "Algebra 1")
+ @course2 = FactoryBot.create(:course, title: "Algebra 2")
+ @course3 = FactoryBot.create(:course, title: "Analysis 1")
+ @course3 = FactoryBot.create(:course, title: "Analysis 2")
end
- it 'returns courses whose title is similar to a given string (#1)' do
- expect(Course.similar_courses('Algebra'))
- .to match_array(['Algebra 1', 'Algebra 2'])
+ it "returns courses whose title is similar to a given string (#1)" do
+ expect(Course.similar_courses("Algebra"))
+ .to match_array(["Algebra 1", "Algebra 2"])
end
- it 'returns courses whose title is similar to a given string (#2)' do
- expect(Course.similar_courses('Algbera'))
- .to match_array(['Algebra 1', 'Algebra 2'])
- end
+ it "returns courses whose title is similar to a given string (#2)" do
+ expect(Course.similar_courses("Algbera"))
+ .to match_array(["Algebra 1", "Algebra 2"])
+ end
- it 'returns courses whose title is similar to a given string (#3)' do
- expect(Course.similar_courses('Ara')).to eq([])
+ it "returns courses whose title is similar to a given string (#3)" do
+ expect(Course.similar_courses("Ara")).to eq([])
end
end
- describe '#search_by' do
+ describe "#search_by" do
before :all do
Course.destroy_all
@editor1 = FactoryBot.create(:confirmed_user)
@editor2 = FactoryBot.create(:confirmed_user)
- subject = FactoryBot.create(:subject, name: 'Mathematik')
- @program1 = FactoryBot.create(:program, name: 'BSc100', subject: subject)
- @program2 = FactoryBot.create(:program, name: 'BSc50', subject: subject)
- division1 = FactoryBot.create(:division, name: 'Pflichtmodule',
- program: @program1 )
- division2 = FactoryBot.create(:division, name: 'Pflichtmodule',
- program: @program2 )
- @course1 = FactoryBot.create(:course, title: 'Analysis 1',
+ subject = FactoryBot.create(:subject, name: "Mathematik")
+ @program1 = FactoryBot.create(:program, name: "BSc100", subject: subject)
+ @program2 = FactoryBot.create(:program, name: "BSc50", subject: subject)
+ division1 = FactoryBot.create(:division, name: "Pflichtmodule",
+ program: @program1)
+ division2 = FactoryBot.create(:division, name: "Pflichtmodule",
+ program: @program2)
+ @course1 = FactoryBot.create(:course, title: "Analysis 1",
editors: [@editor1])
- @course2 = FactoryBot.create(:course, title: 'Analysis 2',
+ @course2 = FactoryBot.create(:course, title: "Analysis 2",
editors: [@editor2])
- @course3 = FactoryBot.create(:course, title: 'Algebra 1',
+ @course3 = FactoryBot.create(:course, title: "Algebra 1",
editors: [@editor1, @editor2])
- @course4 = FactoryBot.create(:course, title: 'Algebra 2',
+ @course4 = FactoryBot.create(:course, title: "Algebra 2",
editors: [@editor2])
@course5 = FactoryBot.create(:course, :term_independent,
- title: 'Helpdesk',
+ title: "Helpdesk",
editors: [@editor1])
@course1.divisions << [division1, division2]
@course2.divisions << division1
@@ -947,9 +938,9 @@
Course.reindex
end
- it 'returns the correct search results (example 1)' do
- search_params = { all_editors: '1', all_programs: '1', fulltext: '',
- per: 50, term_independent: '0' }
+ it "returns the correct search results (example 1)" do
+ search_params = { all_editors: "1", all_programs: "1", fulltext: "",
+ per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.map(&:id))
@@ -957,69 +948,69 @@
@course5.id])
end
- it 'returns the correct search results (example 2)' do
- search_params = { all_editors: '1', all_programs: '1', fulltext: '',
- per: 50, term_independent: '1' }
+ it "returns the correct search results (example 2)" do
+ search_params = { all_editors: "1", all_programs: "1", fulltext: "",
+ per: 50, term_independent: "1" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id)).to eq([@course5.id])
end
- it 'returns the correct search results (example 3)' do
- search_params = { editor_ids: [@editor1.id], all_programs: '1',
- fulltext: '', per: 50, term_independent: '0' }
+ it "returns the correct search results (example 3)" do
+ search_params = { editor_ids: [@editor1.id], all_programs: "1",
+ fulltext: "", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id))
.to eq([@course3.id, @course1.id, @course5.id])
end
- it 'returns the correct search results (example 4)' do
- search_params = { editor_ids: [@editor2.id], all_programs: '1',
- fulltext: '', per: 50, term_independent: '0' }
+ it "returns the correct search results (example 4)" do
+ search_params = { editor_ids: [@editor2.id], all_programs: "1",
+ fulltext: "", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id))
.to eq([@course3.id, @course4.id, @course2.id])
end
- it 'returns the correct search results (example 5)' do
- search_params = { all_editors: '1', program_ids: [@program1.id],
- fulltext: '', per: 50, term_independent: '0' }
+ it "returns the correct search results (example 5)" do
+ search_params = { all_editors: "1", program_ids: [@program1.id],
+ fulltext: "", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id))
.to eq([@course3.id, @course1.id, @course2.id, @course5.id])
end
- it 'returns the correct search results (example 6)' do
- search_params = { all_editors: '1', program_ids: [@program2.id],
- fulltext: '', per: 50, term_independent: '0' }
+ it "returns the correct search results (example 6)" do
+ search_params = { all_editors: "1", program_ids: [@program2.id],
+ fulltext: "", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id))
.to eq([@course3.id, @course4.id, @course1.id, @course5.id])
end
- it 'returns the correct search results (example 7)' do
- search_params = { all_editors: '1', all_programs: '1',
- fulltext: 'Algebra', per: 50, term_independent: '0' }
+ it "returns the correct search results (example 7)" do
+ search_params = { all_editors: "1", all_programs: "1",
+ fulltext: "Algebra", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id)).to eq([@course3.id, @course4.id])
end
- it 'returns the correct search results (example 8)' do
+ it "returns the correct search results (example 8)" do
search_params = { editor_ids: [@editor1.id], program_ids: [@program1.id],
- fulltext: 'Algebra', per: 50, term_independent: '0' }
+ fulltext: "Algebra", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id)).to eq([@course3.id])
end
- it 'returns the correct search results (example 9)' do
+ it "returns the correct search results (example 9)" do
search_params = { editor_ids: [@editor2.id], program_ids: [@program2.id],
- fulltext: 'Analysis', per: 50, term_independent: '0' }
+ fulltext: "Analysis", per: 50, term_independent: "0" }
search = Course.search_by(search_params, 1)
search.execute
expect(search.results.to_a.map(&:id)).to eq([])
diff --git a/spec/models/course_tag_join_spec.rb b/spec/models/course_tag_join_spec.rb
index bfdb39917..870aacd29 100644
--- a/spec/models/course_tag_join_spec.rb
+++ b/spec/models/course_tag_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe CourseTagJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(CourseTagJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:course_tag_join)).to be_valid
end
# test validations
- it 'is invalid without a course' do
+ it "is invalid without a course" do
expect(FactoryBot.build(:course_tag_join, course: nil)).to be_invalid
end
- it 'is invalid without a tag' do
+ it "is invalid without a tag" do
expect(FactoryBot.build(:course_tag_join, tag: nil)).to be_invalid
end
end
diff --git a/spec/models/division_course_join_spec.rb b/spec/models/division_course_join_spec.rb
index 64941ed0d..1152dbda4 100644
--- a/spec/models/division_course_join_spec.rb
+++ b/spec/models/division_course_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe DivisionCourseJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(DivisionCourseJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:division_course_join)).to be_valid
end
# test validations
- it 'is invalid without a course' do
+ it "is invalid without a course" do
expect(FactoryBot.build(:division_course_join, course: nil)).to be_invalid
end
- it 'is invalid without a division' do
+ it "is invalid without a division" do
expect(FactoryBot.build(:division_course_join, division: nil)).to be_invalid
end
end
diff --git a/spec/models/division_spec.rb b/spec/models/division_spec.rb
index c71608667..473fed431 100644
--- a/spec/models/division_spec.rb
+++ b/spec/models/division_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Division, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Division, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:division)).to be_valid
end
# test validations
- it 'is invalid without a program' do
+ it "is invalid without a program" do
expect(FactoryBot.build(:division, program: nil)).to be_invalid
end
end
diff --git a/spec/models/editable_user_join_spec.rb b/spec/models/editable_user_join_spec.rb
index 58fb00115..4d6aec3b6 100644
--- a/spec/models/editable_user_join_spec.rb
+++ b/spec/models/editable_user_join_spec.rb
@@ -1,33 +1,31 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe EditableUserJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(EditableUserJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:editable_user_join)).to be_valid
end
# test validations
- it 'is invalid without an editable' do
+ it "is invalid without an editable" do
expect(FactoryBot.build(:editable_user_join, editable: nil)).to be_invalid
end
- it 'is invalid without a user' do
+ it "is invalid without a user" do
expect(FactoryBot.build(:editable_user_join, user: nil)).to be_invalid
end
# test traits
- describe 'with course' do
- it 'is associated to a course' do
+ describe "with course" do
+ it "is associated to a course" do
course_join = FactoryBot.build(:editable_user_join, :with_course)
expect(course_join.editable).to be_kind_of(Course)
end
end
- describe 'with lecture' do
- it 'is associated to a lecture' do
+ describe "with lecture" do
+ it "is associated to a lecture" do
lecture_join = FactoryBot.build(:editable_user_join, :with_lecture)
expect(lecture_join.editable).to be_kind_of(Lecture)
end
diff --git a/spec/models/import_spec.rb b/spec/models/import_spec.rb
index 20cc8bb2a..8577f62be 100644
--- a/spec/models/import_spec.rb
+++ b/spec/models/import_spec.rb
@@ -1,26 +1,24 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Import, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Import, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_import)).to be_valid
end
# test validations
- it 'is invalid without a medium' do
+ it "is invalid without a medium" do
import = FactoryBot.build(:valid_import, medium: nil)
expect(import).to be_invalid
end
- it 'is invalid without a teachable' do
+ it "is invalid without a teachable" do
import = FactoryBot.build(:valid_import)
import.teachable = nil
expect(import).to be_invalid
end
- it 'is invalid with duplicate medium inside same teachable' do
+ it "is invalid with duplicate medium inside same teachable" do
import = FactoryBot.create(:valid_import)
new_import = FactoryBot.build(:import)
new_import.teachable = import.teachable
@@ -30,17 +28,17 @@
# test traits
- describe 'with teachable' do
- it 'has an associated lecture' do
+ describe "with teachable" do
+ it "has an associated lecture" do
import = FactoryBot.build(:import, :with_teachable)
expect(import.teachable).to be_kind_of(Lecture)
end
- it 'has an associated course if teachable_sort is :course' do
+ it "has an associated course if teachable_sort is :course" do
import = FactoryBot.build(:import, :with_teachable,
teachable_sort: :course)
expect(import.teachable).to be_kind_of(Course)
end
- it 'has an associated lesson if teachable_sort is :lesson' do
+ it "has an associated lesson if teachable_sort is :lesson" do
import = FactoryBot.build(:import, :with_teachable,
teachable_sort: :lesson)
expect(import.teachable).to be_kind_of(Lesson)
diff --git a/spec/models/interaction_spec.rb b/spec/models/interaction_spec.rb
index 007de0d5a..d42264c37 100644
--- a/spec/models/interaction_spec.rb
+++ b/spec/models/interaction_spec.rb
@@ -1,25 +1,23 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Interaction, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Interaction, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:interaction)).to be_valid
end
# describe traits
- describe 'with stuff' do
+ describe "with stuff" do
before :all do
@interaction = FactoryBot.build(:interaction, :with_stuff)
end
- it 'has a session id' do
+ it "has a session id" do
expect(@interaction.session_id).to be_truthy
end
- it 'has a referrer url' do
+ it "has a referrer url" do
expect(@interaction.referrer_url).to be_truthy
end
- it 'has a full path' do
+ it "has a full path" do
expect(@interaction.full_path).to be_truthy
end
end
diff --git a/spec/models/item_self_join_spec.rb b/spec/models/item_self_join_spec.rb
index 1d36b4b57..e4d2d2d6b 100644
--- a/spec/models/item_self_join_spec.rb
+++ b/spec/models/item_self_join_spec.rb
@@ -1,23 +1,21 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe ItemSelfJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(ItemSelfJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:item_self_join)).to be_valid
end
# test validations
- it 'is invalid without an item' do
+ it "is invalid without an item" do
expect(FactoryBot.build(:item_self_join, item: nil)).to be_invalid
end
- it 'is invalid without a related item' do
+ it "is invalid without a related item" do
expect(FactoryBot.build(:item_self_join, related_item: nil)).to be_invalid
end
- it 'is invalid with a duplicate related_item' do
+ it "is invalid with a duplicate related_item" do
item_join = FactoryBot.create(:item_self_join)
item = item_join.item
related_item = item_join.related_item
diff --git a/spec/models/item_spec.rb b/spec/models/item_spec.rb
index 0fc3adca8..040a40d90 100644
--- a/spec/models/item_spec.rb
+++ b/spec/models/item_spec.rb
@@ -1,44 +1,42 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Item, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Item, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:item)).to be_valid
end
# test validations - SOME ARE MISSING
- it 'is invalid with inadmissible sort' do
- expect(FactoryBot.build(:item, sort: 'some BS')).to be_invalid
+ it "is invalid with inadmissible sort" do
+ expect(FactoryBot.build(:item, sort: "some BS")).to be_invalid
end
# test traits and subfactories
- describe 'with start time' do
- it 'has a start time' do
+ describe "with start time" do
+ it "has a start time" do
item = FactoryBot.build(:item, :with_start_time)
expect(item.start_time).to be_kind_of(TimeStamp)
end
- it 'has the correct start time when the starting_time param is used' do
+ it "has the correct start time when the starting_time param is used" do
item = FactoryBot.build(:item, :with_start_time, starting_time: 1000)
- expect(item.start_time.total_seconds).to eq 1000
+ expect(item.start_time.total_seconds).to eq(1000)
end
end
- describe 'with medium' do
- it 'has a medium' do
+ describe "with medium" do
+ it "has a medium" do
item = FactoryBot.build(:item, :with_medium)
expect(item.medium).to be_kind_of(Medium)
end
- it 'has a medium with a video' do
+ it "has a medium with a video" do
item = FactoryBot.build(:item, :with_medium)
expect(item.medium.video).to be_kind_of(VideoUploader::UploadedFile)
end
end
- describe 'item for sample video' do
- it 'has a valid factory' do
+ describe "item for sample video" do
+ it "has a valid factory" do
expect(FactoryBot.build(:item_for_sample_video)).to be_valid
end
end
diff --git a/spec/models/lecture_spec.rb b/spec/models/lecture_spec.rb
index c855876e8..26d67fbdb 100644
--- a/spec/models/lecture_spec.rb
+++ b/spec/models/lecture_spec.rb
@@ -1,23 +1,21 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Lecture, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Lecture, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:lecture)).to be_valid
end
# Test validations -- SOME ARE MISSING
- it 'is invalid without a course' do
+ it "is invalid without a course" do
lecture = FactoryBot.build(:lecture, course: nil)
expect(lecture).to be_invalid
end
- it 'is invalid without a teacher' do
+ it "is invalid without a teacher" do
lecture = FactoryBot.build(:lecture, teacher: nil)
expect(lecture).to be_invalid
end
- it 'is invalid if duplicate combination of course, teacher and term' do
+ it "is invalid if duplicate combination of course, teacher and term" do
course = FactoryBot.create(:course)
teacher = FactoryBot.create(:confirmed_user)
term = FactoryBot.create(:term)
@@ -29,62 +27,62 @@
# Test traits
- describe 'lecture with organizational stuff' do
+ describe "lecture with organizational stuff" do
before :all do
@lecture = FactoryBot.build(:lecture, :with_organizational_stuff)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@lecture).to be_valid
end
- it 'has organizational flag set to true' do
- expect(@lecture.organizational).to be true
+ it "has organizational flag set to true" do
+ expect(@lecture.organizational).to be(true)
end
- it 'has an organizational concept' do
+ it "has an organizational concept" do
expect(@lecture.organizational_concept).to be_truthy
end
end
- describe 'lecture which is released for all' do
+ describe "lecture which is released for all" do
before :all do
@lecture = FactoryBot.build(:lecture, :released_for_all)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@lecture).to be_valid
end
- it 'is released for all' do
- expect(@lecture.released).to eq 'all'
+ it "is released for all" do
+ expect(@lecture.released).to eq("all")
end
end
- describe 'term independent lecture' do
+ describe "term independent lecture" do
before :all do
@lecture = FactoryBot.build(:lecture, :term_independent)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@lecture).to be_valid
end
- it 'has no associated term' do
+ it "has no associated term" do
expect(@lecture.term).to be_nil
end
end
- describe 'with table of contents' do
+ describe "with table of contents" do
before :all do
@lecture = FactoryBot.build(:lecture, :with_toc)
end
- it 'has 3 chapters' do
- expect(@lecture.chapters.size).to eq 3
+ it "has 3 chapters" do
+ expect(@lecture.chapters.size).to eq(3)
end
- it 'has 3 sections in each chapter' do
- expect(@lecture.chapters.map { |c| c.sections.size }).to eq [3, 3, 3]
+ it "has 3 sections in each chapter" do
+ expect(@lecture.chapters.map { |c| c.sections.size }).to eq([3, 3, 3])
end
end
- describe 'with sparse table of contents' do
+ describe "with sparse table of contents" do
before :all do
@lecture = FactoryBot.build(:lecture, :with_sparse_toc)
end
- it 'has one chapter' do
- expect(@lecture.chapters.size).to eq 1
+ it "has one chapter" do
+ expect(@lecture.chapters.size).to eq(1)
end
- it 'has one sections in each chapter' do
- expect(@lecture.chapters.map { |c| c.sections.size }).to eq [1]
+ it "has one sections in each chapter" do
+ expect(@lecture.chapters.map { |c| c.sections.size }).to eq([1])
end
end
diff --git a/spec/models/lecture_user_join_spec.rb b/spec/models/lecture_user_join_spec.rb
index 4ed077e99..f711eba3d 100644
--- a/spec/models/lecture_user_join_spec.rb
+++ b/spec/models/lecture_user_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe LectureUserJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(LectureUserJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:lecture_user_join)).to be_valid
end
# test validations
- it 'is invalid without a lecture' do
+ it "is invalid without a lecture" do
expect(FactoryBot.build(:lecture_user_join, lecture: nil)).to be_invalid
end
- it 'is invalid without a user' do
+ it "is invalid without a user" do
expect(FactoryBot.build(:lecture_user_join, user: nil)).to be_invalid
end
end
diff --git a/spec/models/lesson_section_join_spec.rb b/spec/models/lesson_section_join_spec.rb
index c680bb341..5fd55ac3d 100644
--- a/spec/models/lesson_section_join_spec.rb
+++ b/spec/models/lesson_section_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe LessonSectionJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(LessonSectionJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:lesson_section_join)).to be_valid
end
# test validations
- it 'is invalid without a lesson' do
+ it "is invalid without a lesson" do
expect(FactoryBot.build(:lesson_section_join, lesson: nil)).to be_invalid
end
- it 'is invalid without a section' do
+ it "is invalid without a section" do
expect(FactoryBot.build(:lesson_section_join, section: nil)).to be_invalid
end
end
diff --git a/spec/models/lesson_spec.rb b/spec/models/lesson_spec.rb
index f8316c4b4..8bec59107 100644
--- a/spec/models/lesson_spec.rb
+++ b/spec/models/lesson_spec.rb
@@ -1,54 +1,52 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Lesson, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Lesson, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_lesson)).to be_valid
end
# Test validations
- it 'is invalid without a lecture' do
+ it "is invalid without a lecture" do
lesson = FactoryBot.build(:valid_lesson)
lesson.lecture = nil
expect(lesson).to be_invalid
end
- it 'is invalid without a date' do
+ it "is invalid without a date" do
lesson = FactoryBot.build(:valid_lesson)
lesson.date = nil
expect(lesson).to be_invalid
end
- it 'is invalid without a section' do
+ it "is invalid without a section" do
lesson = FactoryBot.build(:lesson, :with_lecture_and_date)
expect(lesson).to be_invalid
end
# Test traits
- describe 'lesson with lecture and date' do
+ describe "lesson with lecture and date" do
before(:all) do
@lesson = FactoryBot.build(:lesson, :with_lecture_and_date)
end
- it 'is invalid when taken alone' do
+ it "is invalid when taken alone" do
expect(@lesson).to be_invalid
end
- it 'has a lecture' do
+ it "has a lecture" do
expect(@lesson.lecture).to be_kind_of(Lecture)
end
end
- describe 'lesson with lecture, date and section' do
+ describe "lesson with lecture, date and section" do
before(:all) do
@lesson = FactoryBot.build(:lesson, :with_lecture_date_and_section)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@lesson).to be_valid
end
- it 'has a lecture' do
+ it "has a lecture" do
expect(@lesson.lecture).to be_kind_of(Lecture)
end
- it 'has one section' do
- expect(@lesson.sections.size).to eq 1
+ it "has one section" do
+ expect(@lesson.sections.size).to eq(1)
end
end
diff --git a/spec/models/lesson_tag_join_spec.rb b/spec/models/lesson_tag_join_spec.rb
index e2e14625d..527373e1a 100644
--- a/spec/models/lesson_tag_join_spec.rb
+++ b/spec/models/lesson_tag_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe LessonTagJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(LessonTagJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:lesson_tag_join)).to be_valid
end
# test validations
- it 'is invalid without a lesson' do
+ it "is invalid without a lesson" do
expect(FactoryBot.build(:lesson_tag_join, lesson: nil)).to be_invalid
end
- it 'is invalid without a tag' do
+ it "is invalid without a tag" do
expect(FactoryBot.build(:lesson_tag_join, tag: nil)).to be_invalid
end
end
diff --git a/spec/models/link_spec.rb b/spec/models/link_spec.rb
index bed730e54..28702e851 100644
--- a/spec/models/link_spec.rb
+++ b/spec/models/link_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Link, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Link, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:link)).to be_valid
end
# test validations
- it 'is invalid if link already exists' do
+ it "is invalid if link already exists" do
medium = FactoryBot.create(:valid_medium)
linked_medium = FactoryBot.create(:valid_medium)
FactoryBot.create(:link, medium: medium, linked_medium: linked_medium)
@@ -20,29 +18,29 @@
# test callbacks
- it 'destroys a link if it is a self-link' do
+ it "destroys a link if it is a self-link" do
medium = FactoryBot.create(:valid_medium)
link = FactoryBot.create(:link, medium: medium,
linked_medium: medium)
id = link.id
- expect(Link.exists?(id)).to be false
+ expect(Link.exists?(id)).to be(false)
end
- it 'creates an inverse if link is not self-inverse' do
+ it "creates an inverse if link is not self-inverse" do
first_medium = FactoryBot.create(:valid_medium)
second_medium = FactoryBot.create(:valid_medium)
FactoryBot.create(:link, medium: first_medium, linked_medium: second_medium)
expect(Link.exists?(medium: second_medium, linked_medium: first_medium))
- .to be true
+ .to be(true)
end
- it 'destroys the inverse after deletion if link is not self-inverse' do
+ it "destroys the inverse after deletion if link is not self-inverse" do
first_medium = FactoryBot.create(:valid_medium)
second_medium = FactoryBot.create(:valid_medium)
link = FactoryBot.create(:link, medium: first_medium,
linked_medium: second_medium)
link.destroy
expect(Link.exists?(medium: second_medium, linked_medium: first_medium))
- .to be false
+ .to be(false)
end
end
diff --git a/spec/models/mampf_expression_spec.rb b/spec/models/mampf_expression_spec.rb
index 48810d3a5..44a06172d 100644
--- a/spec/models/mampf_expression_spec.rb
+++ b/spec/models/mampf_expression_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MampfExpression, type: :model do
- it 'has a factory' do
+RSpec.describe(MampfExpression, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:mampf_expression)).to be_kind_of(MampfExpression)
end
end
diff --git a/spec/models/mampf_matrix_spec.rb b/spec/models/mampf_matrix_spec.rb
index bd68ae5b5..655435bee 100644
--- a/spec/models/mampf_matrix_spec.rb
+++ b/spec/models/mampf_matrix_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MampfMatrix, type: :model do
- it 'has a factory' do
+RSpec.describe(MampfMatrix, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:mampf_matrix)).to be_kind_of(MampfMatrix)
end
end
diff --git a/spec/models/mampf_set_spec.rb b/spec/models/mampf_set_spec.rb
index d50ec4d18..aef3508c4 100644
--- a/spec/models/mampf_set_spec.rb
+++ b/spec/models/mampf_set_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MampfSet, type: :model do
- it 'has a factory' do
+RSpec.describe(MampfSet, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:mampf_set)).to be_kind_of(MampfSet)
end
end
diff --git a/spec/models/mampf_tuple_spec.rb b/spec/models/mampf_tuple_spec.rb
index 830b4e144..04432c546 100644
--- a/spec/models/mampf_tuple_spec.rb
+++ b/spec/models/mampf_tuple_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MampfTuple, type: :model do
- it 'has a factory' do
+RSpec.describe(MampfTuple, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:mampf_tuple)).to be_kind_of(MampfTuple)
end
end
diff --git a/spec/models/manuscript_spec.rb b/spec/models/manuscript_spec.rb
index 31f09e886..7b9572361 100644
--- a/spec/models/manuscript_spec.rb
+++ b/spec/models/manuscript_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Manuscript, type: :model do
- it 'has a factory' do
+RSpec.describe(Manuscript, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:manuscript)).to be_kind_of(Manuscript)
end
end
diff --git a/spec/models/medium_publisher_spec.rb b/spec/models/medium_publisher_spec.rb
index 91866f25c..62f3665ae 100644
--- a/spec/models/medium_publisher_spec.rb
+++ b/spec/models/medium_publisher_spec.rb
@@ -1,45 +1,43 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MediumPublisher, type: :model do
- it 'has a factory' do
+RSpec.describe(MediumPublisher, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:medium_publisher)).to be_kind_of(MediumPublisher)
end
- it 'serializes and deserializes without errors' do
+ it "serializes and deserializes without errors" do
medium = FactoryBot.create(:course_medium)
publisher = FactoryBot.build(:medium_publisher, medium_id: medium.id)
medium.publisher = publisher
medium.save
end
- describe '::parse' do
+ describe "::parse" do
before :all do
@medium = FactoryBot.create(:lecture_medium)
@user = FactoryBot.create(:confirmed_user)
end
- it 'parses correctly (example 1)' do
- params = { release_now: '1', released: 'all',
- release_date: '', lock_comments: '1',
- publish_vertices: '0', create_assignment: '0' }
+ it "parses correctly (example 1)" do
+ params = { release_now: "1", released: "all",
+ release_date: "", lock_comments: "1",
+ publish_vertices: "0", create_assignment: "0" }
publisher = MediumPublisher.parse(@medium, @user, params)
comp_methods = [:release_now, :release_for, :release_date, :lock_comments,
:vertices, :create_assignment]
publisher_array = comp_methods.map { |m| publisher.send(m) }
expect(publisher_array)
- .to eq([true, 'all', nil, true,
+ .to eq([true, "all", nil, true,
false, false])
end
- it 'parses correctly (example 2)' do
- params = { release_now: '0', released: 'users',
- release_date: '04-03-2021 13:50', lock_comments: '0',
- publish_vertices: '1', create_assignment: '1',
- assignment_title: 'Blatt 1', assignment_file_type: '.pdf',
- assignment_deadline: '04-03-2021 14:50',
- assignment_deletion_date: '04-03-2021' }
+ it "parses correctly (example 2)" do
+ params = { release_now: "0", released: "users",
+ release_date: "04-03-2021 13:50", lock_comments: "0",
+ publish_vertices: "1", create_assignment: "1",
+ assignment_title: "Blatt 1", assignment_file_type: ".pdf",
+ assignment_deadline: "04-03-2021 14:50",
+ assignment_deletion_date: "04-03-2021" }
publisher = MediumPublisher.parse(@medium, @user, params)
comp_methods = [:release_now, :release_for, :release_date, :lock_comments,
:vertices, :create_assignment, :assignment_title,
@@ -47,44 +45,44 @@
:assignment_deletion_date]
publisher_array = comp_methods.map { |m| publisher.send(m) }
expect(publisher_array)
- .to eq([false, 'users', Time.zone.parse('04-03-2021 13:50'), false,
- true, true, 'Blatt 1', '.pdf',
- Time.zone.parse('04-03-2021 14:50'), Time.zone.parse('04-03-2021')])
+ .to eq([false, "users", Time.zone.parse("04-03-2021 13:50"), false,
+ true, true, "Blatt 1", ".pdf",
+ Time.zone.parse("04-03-2021 14:50"), Time.zone.parse("04-03-2021")])
end
- it 'rescues argument errors for the release date' do
- params = { release_now: '1', released: 'all',
- release_date: 'w47qwhhhhkc4', lock_comments: '1',
- publish_vertices: '0', create_assignment: '0' }
+ it "rescues argument errors for the release date" do
+ params = { release_now: "1", released: "all",
+ release_date: "w47qwhhhhkc4", lock_comments: "1",
+ publish_vertices: "0", create_assignment: "0" }
publisher = MediumPublisher.parse(@medium, @user, params)
expect(publisher.release_date).to be_nil
end
- it 'rescues argument errors for the assignment deadline' do
- params = { release_now: '0', released: 'all',
- release_date: '04-03-2021 13:50', lock_comments: '1',
- publish_vertices: '0', create_assignment: '1',
- assignment_deadline: 'w47qwhhhhkc4' }
+ it "rescues argument errors for the assignment deadline" do
+ params = { release_now: "0", released: "all",
+ release_date: "04-03-2021 13:50", lock_comments: "1",
+ publish_vertices: "0", create_assignment: "1",
+ assignment_deadline: "w47qwhhhhkc4" }
publisher = MediumPublisher.parse(@medium, @user, params)
expect(publisher.assignment_deadline).to be_nil
end
- it 'rescues argument errors for the assignment deletion date' do
- params = { release_now: '0', released: 'all',
- release_date: '04-03-2021 13:50', lock_comments: '1',
- publish_vertices: '0', create_assignment: '1',
- assignment_deletion_date: 'w47qwhhhhkc4' }
+ it "rescues argument errors for the assignment deletion date" do
+ params = { release_now: "0", released: "all",
+ release_date: "04-03-2021 13:50", lock_comments: "1",
+ publish_vertices: "0", create_assignment: "1",
+ assignment_deletion_date: "w47qwhhhhkc4" }
publisher = MediumPublisher.parse(@medium, @user, params)
expect(publisher.assignment_deletion_date).to be_nil
end
end
- describe '#publish!' do
- context 'without extra stuff' do
+ describe "#publish!" do
+ context "without extra stuff" do
before :all do
@medium = FactoryBot.create(:lecture_medium)
lecture = @medium.teachable
- lecture.update(released: 'all')
+ lecture.update(released: "all")
@user = FactoryBot.create(:confirmed_user, email_for_medium: true)
@medium.editors << @user
@user.lectures << lecture
@@ -95,40 +93,40 @@
@medium.reload
end
- it 'publishes the medium' do
- expect(@medium.released).to eq 'all'
+ it "publishes the medium" do
+ expect(@medium.released).to eq("all")
end
- it 'sets a released_at date' do
- expect(@medium.released_at).not_to be nil
+ it "sets a released_at date" do
+ expect(@medium.released_at).not_to be(nil)
end
- it 'creates notifications' do
- expect(@user.notifications.size).to eq 1
+ it "creates notifications" do
+ expect(@user.notifications.size).to eq(1)
end
end
- it 'publishes the vertices if medium is a quiz and vertices flag is set' do
+ it "publishes the vertices if medium is a quiz and vertices flag is set" do
medium = FactoryBot.create(:valid_quiz, :with_quiz_graph,
teachable_sort: :lecture)
lecture = medium.teachable
- lecture.update(released: 'all')
+ lecture.update(released: "all")
user = FactoryBot.create(:confirmed_user, email_for_medium: true)
medium.editors << user
user.lectures << lecture
lecture.editors << user
- medium.questions.update_all(teachable_type: 'Lecture',
- teachable_id: lecture.id)
+ medium.questions.update(teachable_type: "Lecture",
+ teachable_id: lecture.id)
publisher = FactoryBot.build(:medium_publisher,
medium_id: medium.id,
user_id: user.id,
vertices: true)
medium.update(publisher: publisher)
publisher.publish!
- expect(medium.questions.map(&:released).uniq).to eq(['all'])
+ expect(medium.questions.map(&:released).uniq).to eq(["all"])
end
- it 'creates an assignment if the create_assignment flag is set' do
+ it "creates an assignment if the create_assignment flag is set" do
medium = FactoryBot.create(:lecture_medium)
lecture = medium.teachable
user = FactoryBot.create(:confirmed_user)
@@ -137,16 +135,16 @@
medium_id: medium.id,
user_id: user.id,
create_assignment: true,
- assignment_title: 'Blatt 1',
- assignment_deadline: '2025-05-02 12:00',
- assignment_deletion_date: '2025-05-02',
- assignment_file_type: '.pdf')
+ assignment_title: "Blatt 1",
+ assignment_deadline: "2025-05-02 12:00",
+ assignment_deletion_date: "2025-05-02",
+ assignment_file_type: ".pdf")
publisher.publish!
lecture.reload
- expect(lecture.assignments.size).to eq 1
+ expect(lecture.assignments.size).to eq(1)
end
- it 'locks the medium thread if the lock_assignment flag is set' do
+ it "locks the medium thread if the lock_assignment flag is set" do
medium = FactoryBot.create(:lecture_medium)
user = FactoryBot.create(:confirmed_user)
medium.editors << user
@@ -161,45 +159,45 @@
# TODO: check if emails are sent out
end
- describe '#assignment' do
+ describe "#assignment" do
before :all do
@medium = FactoryBot.create(:lecture_medium)
@lecture = @medium.teachable
user = FactoryBot.create(:confirmed_user)
@medium.editors << user
@publisher = FactoryBot.build(:medium_publisher,
- medium_id: @medium.id,
- user_id: user.id,
- create_assignment: true,
- assignment_title: 'Blatt 1',
- assignment_deadline:
- Time.zone.parse('2025-05-02 12:00'),
- assignment_deletion_date:
- Time.zone.parse('2025-05-02'),
- assignment_file_type: '.pdf')
+ medium_id: @medium.id,
+ user_id: user.id,
+ create_assignment: true,
+ assignment_title: "Blatt 1",
+ assignment_deadline:
+ Time.zone.parse("2025-05-02 12:00"),
+ assignment_deletion_date:
+ Time.zone.parse("2025-05-02"),
+ assignment_file_type: ".pdf")
end
- it 'returns an assignment' do
+ it "returns an assignment" do
expect(@publisher.assignment).to be_kind_of(Assignment)
end
- it 'builds the correspnding assignment if the create_assignment flag is '\
- 'set' do
+ it "builds the correspnding assignment if the create_assignment flag is " \
+ "set" do
assignment = @publisher.assignment
expect([assignment.medium, assignment.lecture, assignment.title,
assignment.deadline, assignment.accepted_file_type])
- .to eq([@medium, @lecture, 'Blatt 1',
- Time.zone.parse('2025-05-02 12:00'), '.pdf'])
+ .to eq([@medium, @lecture, "Blatt 1",
+ Time.zone.parse("2025-05-02 12:00"), ".pdf"])
end
end
- describe '#errors' do
+ describe "#errors" do
before :all do
@medium = FactoryBot.create(:lecture_medium)
@user = FactoryBot.create(:confirmed_user)
end
- it 'returns {} if there are no errors (example 1)' do
+ it "returns {} if there are no errors (example 1)" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
@@ -208,22 +206,22 @@
expect(publisher.errors).to eq({})
end
- it 'returns {} if there are no errors (example 2)' do
+ it "returns {} if there are no errors (example 2)" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: false,
- release_date: Time.zone.now + 1.day,
+ release_date: 1.day.from_now,
create_assignment: true,
- assignment_title: 'Blatt 1',
- assignment_file_type: '.pdf',
- assignment_deadline: Time.zone.now + 2.days,
+ assignment_title: "Blatt 1",
+ assignment_file_type: ".pdf",
+ assignment_deadline: 2.days.from_now,
assignment_deletion_date: Time.zone.today + 2.days)
expect(publisher.errors).to eq({})
end
- it 'returns a release date error if release is scheduled later but ' \
- 'no release date is set' do
+ it "returns a release date error if release is scheduled later but " \
+ "no release date is set" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
@@ -232,29 +230,29 @@
expect(publisher.errors[:release_date]).not_to be_nil
end
- it 'returns a release date error if release is scheduled later but ' \
- 'release date is in the past' do
+ it "returns a release date error if release is scheduled later but " \
+ "release date is in the past" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: false,
- release_date: Time.zone.now - 1.day)
+ release_date: 1.day.ago)
expect(publisher.errors[:release_date]).not_to be_nil
end
- it 'returns an assignment deadline error if release is scheduled now ' \
- 'and deadline is in the past' do
+ it "returns an assignment deadline error if release is scheduled now " \
+ "and deadline is in the past" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: true,
create_assignment: true,
- assignment_deadline: Time.zone.now - 1.day)
+ assignment_deadline: 1.day.ago)
expect(publisher.errors[:assignment_deadline]).not_to be_nil
end
- it 'returns an assignment deletion date error if release is scheduled now' \
- ' and deletion date is in the past' do
+ it "returns an assignment deletion date error if release is scheduled now " \
+ "and deletion date is in the past" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
@@ -265,43 +263,43 @@
expect(publisher.errors[:assignment_deletion_date]).not_to be_nil
end
- it 'returns an assignment deadline error if release is scheduled later ' \
- 'and deadline is before that' do
+ it "returns an assignment deadline error if release is scheduled later " \
+ "and deadline is before that" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: false,
- release_date: Time.zone.now + 2.days,
+ release_date: 2.days.from_now,
create_assignment: true,
- assignment_deadline: Time.zone.now + 1.days)
+ assignment_deadline: 1.day.from_now)
expect(publisher.errors[:assignment_deadline]).not_to be_nil
end
- it 'returns an assignment title error if assignment is to be created but ' \
- 'no title is given' do
+ it "returns an assignment title error if assignment is to be created but " \
+ "no title is given" do
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: true,
create_assignment: true,
- assignment_title: '')
+ assignment_title: "")
expect(publisher.errors[:assignment_title]).not_to be_nil
end
- it 'returns an assignment title error if assignment is to be created but ' \
- 'title of an already existing assignment in the lecture is given' do
+ it "returns an assignment title error if assignment is to be created but " \
+ "title of an already existing assignment in the lecture is given" do
Assignment.create(lecture: @medium.teachable, medium: @medium,
- title: 'Blatt 1', deadline: Time.zone.now + 1.day,
- accepted_file_type: '.pdf')
+ title: "Blatt 1", deadline: 1.day.from_now,
+ accepted_file_type: ".pdf")
publisher = FactoryBot.build(:medium_publisher,
medium_id: @medium.id,
user_id: @user.id,
release_now: true,
create_assignment: true,
- assignment_title: 'Blatt 1',
- assignment_deadline: Time.zone.now + 2.days,
+ assignment_title: "Blatt 1",
+ assignment_deadline: 2.days.from_now,
assignment_deletion_date: Time.zone.today + 2.days,
- assignment_file_type: '.pdf')
+ assignment_file_type: ".pdf")
expect(publisher.errors[:assignment_title]).not_to be_nil
end
end
diff --git a/spec/models/medium_spec.rb b/spec/models/medium_spec.rb
index 9dc9f0488..2fca9e938 100644
--- a/spec/models/medium_spec.rb
+++ b/spec/models/medium_spec.rb
@@ -1,139 +1,137 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Medium, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Medium, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_medium)).to be_valid
end
# test validations - INCOMPLETE
- it 'is invalid without a sort' do
+ it "is invalid without a sort" do
medium = FactoryBot.build(:medium, sort: nil)
expect(medium).to be_invalid
end
- it 'is invalid with improper sort' do
- medium = FactoryBot.build(:medium, sort: 'Test')
+ it "is invalid with improper sort" do
+ medium = FactoryBot.build(:medium, sort: "Test")
expect(medium).to be_invalid
end
- it 'is invalid if external_reference_link is not a valid http link' do
- medium = FactoryBot.build(:medium, external_reference_link: 'aaa')
+ it "is invalid if external_reference_link is not a valid http link" do
+ medium = FactoryBot.build(:medium, external_reference_link: "aaa")
expect(medium).to be_invalid
end
# test traits and factories
- describe 'with description' do
- it 'has a description' do
+ describe "with description" do
+ it "has a description" do
medium = FactoryBot.build(:medium, :with_description)
expect(medium.description).to be_truthy
end
end
- describe 'with editors' do
- it 'has the correct number of editors' do
+ describe "with editors" do
+ it "has the correct number of editors" do
medium = FactoryBot.build(:medium, :with_editors, editors_count: 2)
- expect(medium.editors.size).to eq 2
+ expect(medium.editors.size).to eq(2)
end
- it 'has one editor when called without editors_count parameter' do
+ it "has one editor when called without editors_count parameter" do
medium = FactoryBot.build(:medium, :with_editors)
- expect(medium.editors.size).to eq 1
+ expect(medium.editors.size).to eq(1)
end
end
- describe 'with tags' do
- it 'has the correct number of tags' do
+ describe "with tags" do
+ it "has the correct number of tags" do
medium = FactoryBot.build(:medium, :with_tags, tags_count: 4)
- expect(medium.tags.size).to eq 4
+ expect(medium.tags.size).to eq(4)
end
- it 'has two tags when called without tags_count parameter' do
+ it "has two tags when called without tags_count parameter" do
medium = FactoryBot.build(:medium, :with_tags)
- expect(medium.tags.size).to eq 2
+ expect(medium.tags.size).to eq(2)
end
end
- describe 'with linked media' do
- it 'has the correct number of linked media' do
+ describe "with linked media" do
+ it "has the correct number of linked media" do
medium = FactoryBot.build(:medium, :with_linked_media,
linked_media_count: 3)
- expect(medium.linked_media.size).to eq 3
+ expect(medium.linked_media.size).to eq(3)
end
- it 'has two linked media when called without linked_media_count param' do
+ it "has two linked media when called without linked_media_count param" do
medium = FactoryBot.build(:medium, :with_linked_media)
- expect(medium.linked_media.size).to eq 2
+ expect(medium.linked_media.size).to eq(2)
end
end
- describe 'with teachable' do
- it 'has an associated lecture if no parameter is given' do
+ describe "with teachable" do
+ it "has an associated lecture if no parameter is given" do
medium = FactoryBot.build(:medium, :with_teachable)
expect(medium.teachable).to be_kind_of(Lecture)
end
- it 'has an associated lesson if teachable_sort param is set to :lesson' do
+ it "has an associated lesson if teachable_sort param is set to :lesson" do
medium = FactoryBot.build(:medium, :with_teachable,
teachable_sort: :lesson)
expect(medium.teachable).to be_kind_of(Lesson)
end
- it 'has an associated course if teachable_sort param is set to :course' do
+ it "has an associated course if teachable_sort param is set to :course" do
medium = FactoryBot.build(:medium, :with_teachable,
teachable_sort: :course)
expect(medium.teachable).to be_kind_of(Course)
end
end
- describe 'with manuscript' do
- it 'has a manuscript' do
+ describe "with manuscript" do
+ it "has a manuscript" do
medium = FactoryBot.build(:medium, :with_manuscript)
expect(medium.manuscript).to be_kind_of(PdfUploader::UploadedFile)
end
end
- describe 'with video' do
- it 'has a video' do
+ describe "with video" do
+ it "has a video" do
medium = FactoryBot.build(:medium, :with_video)
expect(medium.video).to be_kind_of(VideoUploader::UploadedFile)
end
end
- describe 'lesson medium' do
+ describe "lesson medium" do
before :all do
@medium = FactoryBot.build(:lesson_medium)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@medium).to be_valid
end
- it 'is associated to a lesson' do
+ it "is associated to a lesson" do
expect(@medium.teachable).to be_kind_of(Lesson)
end
- it 'has an editor that matches the teacher of the lecture to the lesson' do
+ it "has an editor that matches the teacher of the lecture to the lesson" do
expect(@medium.editors).to include @medium.teachable.lecture.teacher
end
end
- describe 'lecture medium' do
+ describe "lecture medium" do
before :all do
@medium = FactoryBot.build(:lecture_medium)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@medium).to be_valid
end
- it 'is associated to a lecture' do
+ it "is associated to a lecture" do
expect(@medium.teachable).to be_kind_of(Lecture)
end
- it 'has an editor that matches the teacher of the lecture' do
+ it "has an editor that matches the teacher of the lecture" do
expect(@medium.editors).to include @medium.teachable.teacher
end
end
- describe 'course medium' do
+ describe "course medium" do
before :all do
@medium = FactoryBot.build(:course_medium)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@medium).to be_valid
end
- it 'is associated to a course' do
+ it "is associated to a course" do
expect(@medium.teachable).to be_kind_of(Course)
end
end
diff --git a/spec/models/medium_tag_join_spec.rb b/spec/models/medium_tag_join_spec.rb
index e3e6b2098..4216e3dbd 100644
--- a/spec/models/medium_tag_join_spec.rb
+++ b/spec/models/medium_tag_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe MediumTagJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(MediumTagJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:medium_tag_join)).to be_valid
end
# test validations
- it 'is invalid without a medium' do
+ it "is invalid without a medium" do
expect(FactoryBot.build(:medium_tag_join, medium: nil)).to be_invalid
end
- it 'is invalid without a tag' do
+ it "is invalid without a tag" do
expect(FactoryBot.build(:medium_tag_join, tag: nil)).to be_invalid
end
end
diff --git a/spec/models/notification_spec.rb b/spec/models/notification_spec.rb
index d90b9b590..1e022eedf 100644
--- a/spec/models/notification_spec.rb
+++ b/spec/models/notification_spec.rb
@@ -1,29 +1,27 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Notification, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Notification, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:notification)).to be_valid
end
# test validations
- it 'is invalid without a recipient' do
+ it "is invalid without a recipient" do
expect(FactoryBot.build(:notification, recipient: nil)).to be_invalid
end
# test traits
- describe 'with notifiable' do
- it 'has a notifiable' do
+ describe "with notifiable" do
+ it "has a notifiable" do
notification = FactoryBot.build(:notification, :with_notifiable)
expect(notification.notifiable).not_to be_nil
end
- it 'has a notifiable of the correct sort' do
+ it "has a notifiable of the correct sort" do
notification = FactoryBot.build(:notification, :with_notifiable,
- notifiable_sort: 'Lecture')
+ notifiable_sort: "Lecture")
expect(notification.notifiable).to be_kind_of(Lecture)
end
end
diff --git a/spec/models/notion_spec.rb b/spec/models/notion_spec.rb
index 941d725ec..31c6fa334 100644
--- a/spec/models/notion_spec.rb
+++ b/spec/models/notion_spec.rb
@@ -1,38 +1,36 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Notion, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Notion, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.create(:valid_notion)).to be_valid
end
# test validations
- it 'is invalid without a title' do
+ it "is invalid without a title" do
notion = FactoryBot.build(:valid_notion, title: nil)
expect(notion).to be_invalid
end
- it 'is invalid with a duplicate title in the same locale' do
- FactoryBot.create(:valid_notion, locale: 'de', title: 'usual BS')
- notion = FactoryBot.build(:valid_notion, locale: 'de', title: 'usual BS')
+ it "is invalid with a duplicate title in the same locale" do
+ FactoryBot.create(:valid_notion, locale: "de", title: "usual BS")
+ notion = FactoryBot.build(:valid_notion, locale: "de", title: "usual BS")
expect(notion).to be_invalid
end
- it 'is invalid if no tag is present and it is persisted' do
+ it "is invalid if no tag is present and it is persisted" do
notion = FactoryBot.create(:notion)
expect(notion).to be_invalid
end
# test traits
- describe 'notion with tag' do
+ describe "notion with tag" do
before :all do
@notion = FactoryBot.build(:notion, :with_tag)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@notion).to be_valid
end
- it 'has a tag' do
+ it "has a tag" do
expect(@notion.tag).to be_kind_of(Tag)
end
end
diff --git a/spec/models/probe_spec.rb b/spec/models/probe_spec.rb
index 701291bda..59a567d97 100644
--- a/spec/models/probe_spec.rb
+++ b/spec/models/probe_spec.rb
@@ -1,43 +1,41 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Probe, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Probe, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:probe)).to be_valid
end
# describe traits
- describe 'with stuff' do
+ describe "with stuff" do
before :all do
@probe = FactoryBot.build(:probe, :with_stuff)
end
- it 'has a question id' do
+ it "has a question id" do
expect(@probe.question_id).to be_kind_of(Integer)
end
- it 'quiz_id' do
+ it "quiz_id" do
expect(@probe.quiz_id).to be_kind_of(Integer)
end
- it 'is correct or not' do
+ it "is correct or not" do
expect(@probe.correct).to be_in([true, false])
end
- it 'has a session id' do
+ it "has a session id" do
expect(@probe.session_id).to be_truthy
end
- it 'has a progress' do
+ it "has a progress" do
expect(@probe.progress).to be_kind_of(Integer)
end
- it 'has a success' do
+ it "has a success" do
expect(@probe.success).to be_kind_of(Integer)
end
- it 'has a success that is between 1 and 3 if progress is -1' do
+ it "has a success that is between 1 and 3 if progress is -1" do
probe = FactoryBot.build(:probe, :with_stuff, progress: -1)
- expect(probe.success.in?([1, 2, 3])).to be true
+ expect(probe.success.in?([1, 2, 3])).to be(true)
end
- it 'has a success that is between 1 and progress' do
+ it "has a success that is between 1 and progress" do
probe = FactoryBot.build(:probe, :with_stuff, progress: 10)
- expect(probe.success.in?((1..10).to_a)).to be true
+ expect(probe.success.in?((1..10).to_a)).to be(true)
end
end
end
diff --git a/spec/models/program_spec.rb b/spec/models/program_spec.rb
index 937f5fd8b..05d9a21a2 100644
--- a/spec/models/program_spec.rb
+++ b/spec/models/program_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Program, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Program, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:program)).to be_valid
end
# test validations
- it 'is invalid without a subject' do
+ it "is invalid without a subject" do
expect(FactoryBot.build(:program, subject: nil)).to be_invalid
end
end
diff --git a/spec/models/question_sampler_spec.rb b/spec/models/question_sampler_spec.rb
index 983bc4436..51ad1425f 100644
--- a/spec/models/question_sampler_spec.rb
+++ b/spec/models/question_sampler_spec.rb
@@ -1,24 +1,22 @@
-# frozen_string_literal: true
-
-RSpec.describe QuestionSampler, type: :model do
- it 'has a valid factory' do
+RSpec.describe(QuestionSampler, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:question_sampler)).to be_kind_of(QuestionSampler)
end
- describe '#sample!' do
+ describe "#sample!" do
before :all do
@questions = Question.where(id: FactoryBot.create_list(:valid_question, 4)
.map(&:id))
end
- it 'returns [] if no tags are given' do
+ it "returns [] if no tags are given" do
question_sampler = FactoryBot.build(:question_sampler,
questions: @questions)
- expect(question_sampler.sample!).to eq []
+ expect(question_sampler.sample!).to eq([])
end
- it 'returns an array with the correct length if not enough questions match'\
- ' the tags' do
+ it "returns an array with the correct length if not enough questions match " \
+ "the tags" do
tags = Tag.where(id: FactoryBot.create_list(:tag, 3).map(&:id))
@questions[0].tags << tags[0]
@questions[1].tags << tags[1]
@@ -26,10 +24,10 @@
questions: @questions,
tags: tags,
count: 3)
- expect(question_sampler.sample!.size).to eq 2
+ expect(question_sampler.sample!.size).to eq(2)
end
- context 'in a simple example' do
+ context "in a simple example" do
before :all do
tags = Tag.where(id: FactoryBot.create_list(:tag, 3).map(&:id))
@questions[0].tags << tags[0]
@@ -43,16 +41,16 @@
@sample = @question_sampler.sample!
end
- it 'returns an array with the correct length' do
- expect(@sample.size).to eq 3
+ it "returns an array with the correct length" do
+ expect(@sample.size).to eq(3)
end
- it 'does not return duplicates' do
- expect(@sample.uniq.size).to eq @sample.size
+ it "does not return duplicates" do
+ expect(@sample.uniq.size).to eq(@sample.size)
end
- it 'returns a list of questions that is a subset of the given list' do
- expect(@sample - @questions.pluck(:id)).to eq []
+ it "returns a list of questions that is a subset of the given list" do
+ expect(@sample - @questions.pluck(:id)).to eq([])
end
end
end
diff --git a/spec/models/question_spec.rb b/spec/models/question_spec.rb
index bd3d5e84d..b29054ea5 100644
--- a/spec/models/question_spec.rb
+++ b/spec/models/question_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Question, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Question, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_question)).to be_valid
end
@@ -11,36 +9,36 @@
# test traits
- describe 'with stuff' do
+ describe "with stuff" do
before :all do
@question = FactoryBot.build(:question, :with_stuff)
end
- it 'has a text' do
+ it "has a text" do
expect(@question.text).to be_truthy
end
- it 'has a hint' do
+ it "has a hint" do
expect(@question.hint).to be_truthy
end
- it 'has a level' do
+ it "has a level" do
expect(@question.level).to be_kind_of(Integer)
end
- it 'is a multiple choice question' do
- expect(@question.question_sort).to eq 'mc'
+ it "is a multiple choice question" do
+ expect(@question.question_sort).to eq("mc")
end
- it 'is independent' do
- expect(@question.independent).to be true
+ it "is independent" do
+ expect(@question.independent).to be(true)
end
end
- describe 'with answers' do
- it 'has 3 answers' do
+ describe "with answers" do
+ it "has 3 answers" do
question = FactoryBot.build(:valid_question, :with_answers)
- expect(question.answers.size).to eq 3
+ expect(question.answers.size).to eq(3)
end
- it 'has the correct amount of answers with answers_count param' do
+ it "has the correct amount of answers with answers_count param" do
question = FactoryBot.build(:valid_question, :with_answers,
answers_count: 4)
- expect(question.answers.size).to eq 4
+ expect(question.answers.size).to eq(4)
end
end
diff --git a/spec/models/quiz_certificate_spec.rb b/spec/models/quiz_certificate_spec.rb
index 1c1d0e3e0..9780e1d6d 100644
--- a/spec/models/quiz_certificate_spec.rb
+++ b/spec/models/quiz_certificate_spec.rb
@@ -1,29 +1,27 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe QuizCertificate, type: :model do
- it 'has a valid factory' do
+RSpec.describe(QuizCertificate, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:quiz_certificate)).to be_valid
end
# test validations - this is done one the level of the parent Medium model
- it 'is invalid without a quiz' do
+ it "is invalid without a quiz" do
expect(FactoryBot.build(:quiz_certificate, quiz: nil)).to be_invalid
end
# test traits and subfactories
- describe 'with user' do
- it 'has a user' do
+ describe "with user" do
+ it "has a user" do
quiz_certificate = FactoryBot.build(:quiz_certificate, :with_user)
expect(quiz_certificate.user).to be_kind_of(User)
end
end
- describe 'with valid quiz' do
- it 'has a valid quiz' do
+ describe "with valid quiz" do
+ it "has a valid quiz" do
quiz_certificate = FactoryBot.build(:quiz_certificate, :with_valid_quiz)
expect(quiz_certificate.quiz).to be_valid
end
@@ -31,7 +29,7 @@
# test callbacks
- it 'gets a code afeter being created' do
+ it "gets a code afeter being created" do
quiz_certificate = FactoryBot.create(:quiz_certificate, :with_valid_quiz)
expect(quiz_certificate.code).to be_truthy
end
diff --git a/spec/models/quiz_graph_spec.rb b/spec/models/quiz_graph_spec.rb
index c37ac418e..8f1d970a1 100644
--- a/spec/models/quiz_graph_spec.rb
+++ b/spec/models/quiz_graph_spec.rb
@@ -1,31 +1,29 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe QuizGraph, type: :model do
- it 'has a valid factory' do
+RSpec.describe(QuizGraph, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:quiz_graph)).to be_valid
end
# test traits and subfactories
- describe 'linear graph' do
+ describe "linear graph" do
before :all do
@graph = FactoryBot.build(:quiz_graph, :linear)
end
- it 'does not contain errors' do
- expect(@graph.find_errors).to eq []
+ it "does not contain errors" do
+ expect(@graph.find_errors).to eq([])
end
- it 'has 3 questions when called without question_count parameter' do
- expect(@graph.vertices.keys).to eq [1, 2, 3]
+ it "has 3 questions when called without question_count parameter" do
+ expect(@graph.vertices.keys).to eq([1, 2, 3])
end
- it 'has no nontrivial edges' do
+ it "has no nontrivial edges" do
expect(@graph.edges).to eq({})
end
- it 'has 1 as root' do
- expect(@graph.root).to eq 1
+ it "has 1 as root" do
+ expect(@graph.root).to eq(1)
end
- it 'has a linear default table' do
+ it "has a linear default table" do
expect(@graph.default_table).to eq({ 1 => 2, 2 => 3, 3 => -1 })
end
end
diff --git a/spec/models/quiz_round_spec.rb b/spec/models/quiz_round_spec.rb
index af45b3a35..87e4ec3cc 100644
--- a/spec/models/quiz_round_spec.rb
+++ b/spec/models/quiz_round_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe QuizRound, type: :model do
- it 'has a valid factory' do
+RSpec.describe(QuizRound, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:quiz_round)).to be_valid
end
end
diff --git a/spec/models/quiz_spec.rb b/spec/models/quiz_spec.rb
index e7681c1ca..1e35bc7dd 100644
--- a/spec/models/quiz_spec.rb
+++ b/spec/models/quiz_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Quiz, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Quiz, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_quiz)).to be_valid
end
@@ -11,17 +9,17 @@
# test traits and subfactories
- describe 'with quiz graph' do
+ describe "with quiz graph" do
before :all do
@quiz = FactoryBot.build(:valid_quiz, :with_quiz_graph)
end
- it 'has no errors' do
- expect(@quiz.find_errors).to eq []
+ it "has no errors" do
+ expect(@quiz.find_errors).to eq([])
end
end
- describe 'random quiz' do
- it 'has a valid factory' do
+ describe "random quiz" do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_random_quiz)).to be_valid
end
end
diff --git a/spec/models/reader_spec.rb b/spec/models/reader_spec.rb
index 3fc33bdb2..ac1e66682 100644
--- a/spec/models/reader_spec.rb
+++ b/spec/models/reader_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Reader, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Reader, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:reader)).to be_valid
end
# test validations
- it 'is invalid without a user' do
+ it "is invalid without a user" do
expect(FactoryBot.build(:reader, user: nil)).to be_invalid
end
- it 'is invalid without a thread' do
+ it "is invalid without a thread" do
expect(FactoryBot.build(:reader, thread: nil)).to be_invalid
end
end
diff --git a/spec/models/referral_spec.rb b/spec/models/referral_spec.rb
index a08d70761..200521a9c 100644
--- a/spec/models/referral_spec.rb
+++ b/spec/models/referral_spec.rb
@@ -1,41 +1,39 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Referral, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Referral, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:referral)).to be_valid
end
# test validations - INCOMPLETE
- it 'is invalid without an item' do
+ it "is invalid without an item" do
expect(FactoryBot.build(:referral, item: nil)).to be_invalid
end
- it 'is invalid without a medium' do
+ it "is invalid without a medium" do
expect(FactoryBot.build(:referral, medium: nil)).to be_invalid
end
# test traits and subfactories
- describe 'with times' do
+ describe "with times" do
before :all do
@referral = FactoryBot.build(:referral, :with_times)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@referral).to be_valid
end
- it 'has a start time' do
+ it "has a start time" do
expect(@referral.start_time).to be_kind_of(TimeStamp)
end
- it 'has an end time' do
+ it "has an end time" do
expect(@referral.end_time).to be_kind_of(TimeStamp)
end
end
- describe 'referral for sample video' do
- it 'has a valid factory' do
+ describe "referral for sample video" do
+ it "has a valid factory" do
expect(FactoryBot.build(:referral_for_sample_video)).to be_valid
end
end
diff --git a/spec/models/relation_spec.rb b/spec/models/relation_spec.rb
index 8f542e1af..8942eb6a1 100644
--- a/spec/models/relation_spec.rb
+++ b/spec/models/relation_spec.rb
@@ -1,25 +1,23 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Relation, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Relation, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:relation)).to be_valid
end
# test validations
- it 'is invalid without tag' do
+ it "is invalid without tag" do
relation = FactoryBot.build(:relation, tag: nil)
expect(relation).to be_invalid
end
- it 'is invalid without related_tag' do
+ it "is invalid without related_tag" do
relation = FactoryBot.build(:relation, related_tag: nil)
expect(relation).to be_invalid
end
- it 'is invalid if relation already exists' do
+ it "is invalid if relation already exists" do
tag = FactoryBot.create(:tag)
related_tag = FactoryBot.create(:tag)
FactoryBot.create(:relation, tag: tag, related_tag: related_tag)
@@ -30,26 +28,26 @@
# test callbacks
- it 'destroys itself if it relates tag to itself' do
+ it "destroys itself if it relates tag to itself" do
tag = FactoryBot.create(:tag)
relation = FactoryBot.create(:relation, tag: tag, related_tag: tag)
- expect(Relation.find_by_id(relation.id)).to be_nil
+ expect(Relation.find_by(id: relation.id)).to be_nil
end
- it 'creates an inverse if relation is not self-inverse' do
+ it "creates an inverse if relation is not self-inverse" do
first_tag = FactoryBot.create(:tag)
second_tag = FactoryBot.create(:tag)
FactoryBot.create(:relation, tag: first_tag, related_tag: second_tag)
- expect(Relation.exists?(tag: second_tag, related_tag: first_tag)).to be true
+ expect(Relation.exists?(tag: second_tag, related_tag: first_tag)).to be(true)
end
- it 'destroys the inverse after deletion if relation is not self-inverse' do
+ it "destroys the inverse after deletion if relation is not self-inverse" do
first_tag = FactoryBot.create(:tag)
second_tag = FactoryBot.create(:tag)
relation = FactoryBot.create(:relation, tag: first_tag,
related_tag: second_tag)
relation.destroy
expect(Relation.exists?(tag: second_tag, related_tag: first_tag))
- .to be false
+ .to be(false)
end
end
diff --git a/spec/models/remark_spec.rb b/spec/models/remark_spec.rb
index ea1141e66..326dd40ca 100644
--- a/spec/models/remark_spec.rb
+++ b/spec/models/remark_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Remark, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Remark, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_remark)).to be_valid
end
@@ -11,8 +9,8 @@
# test traits
- describe 'with text' do
- it 'has a text' do
+ describe "with text" do
+ it "has a text" do
remark = FactoryBot.build(:remark, :with_text)
expect(remark.text).to be_truthy
end
diff --git a/spec/models/section_spec.rb b/spec/models/section_spec.rb
index 7677c6d3b..314b265e6 100644
--- a/spec/models/section_spec.rb
+++ b/spec/models/section_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Section, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Section, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:section)).to be_valid
end
# test validations
- it 'is invalid without a title' do
+ it "is invalid without a title" do
section = FactoryBot.build(:section, title: nil)
expect(section).to be_invalid
end
diff --git a/spec/models/section_tag_join_spec.rb b/spec/models/section_tag_join_spec.rb
index e43a7ff4e..18558c436 100644
--- a/spec/models/section_tag_join_spec.rb
+++ b/spec/models/section_tag_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe SectionTagJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(SectionTagJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:section_tag_join)).to be_valid
end
# test validations
- it 'is invalid without a section' do
+ it "is invalid without a section" do
expect(FactoryBot.build(:section_tag_join, section: nil)).to be_invalid
end
- it 'is invalid without a tag' do
+ it "is invalid without a tag" do
expect(FactoryBot.build(:section_tag_join, tag: nil)).to be_invalid
end
end
diff --git a/spec/models/solution_spec.rb b/spec/models/solution_spec.rb
index 9be36124c..344eeed78 100644
--- a/spec/models/solution_spec.rb
+++ b/spec/models/solution_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Solution, type: :model do
- it 'has a factory' do
+RSpec.describe(Solution, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:solution)).to be_kind_of(Solution)
end
end
diff --git a/spec/models/subject_spec.rb b/spec/models/subject_spec.rb
index 177782a95..6080a2985 100644
--- a/spec/models/subject_spec.rb
+++ b/spec/models/subject_spec.rb
@@ -1,9 +1,7 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Subject, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Subject, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:subject)).to be_valid
end
end
diff --git a/spec/models/submission_cleaner_spec.rb b/spec/models/submission_cleaner_spec.rb
index b77caab5a..a1670c666 100644
--- a/spec/models/submission_cleaner_spec.rb
+++ b/spec/models/submission_cleaner_spec.rb
@@ -1,20 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe SubmissionCleaner, type: :model do
- it 'has a factory' do
+RSpec.describe(SubmissionCleaner, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:submission_cleaner))
.to be_kind_of(SubmissionCleaner)
end
- describe 'with sample submissions' do
-
+ describe "with sample submissions" do
before :all do
Term.destroy_all
ActionMailer::Base.deliveries = []
- @term1 = FactoryBot.create(:term, year: Time.zone.today.year, season: 'SS')
- @term2 = FactoryBot.create(:term, year: Time.zone.today.year - 1, season: 'WS')
+ @term1 = FactoryBot.create(:term, year: Time.zone.today.year, season: "SS")
+ @term2 = FactoryBot.create(:term, year: Time.zone.today.year - 1, season: "WS")
@lecture1 = FactoryBot.create(:lecture)
@lecture2 = FactoryBot.create(:lecture)
tutorial1 = FactoryBot.create(:tutorial, :with_tutors, lecture: @lecture1)
@@ -44,23 +41,23 @@
assignment: assignment2)
@submission2.users << @user2
@submission3 = FactoryBot.create(:submission,
- tutorial: tutorial3,
- assignment: assignment3)
+ tutorial: tutorial3,
+ assignment: assignment3)
@submission3.users << @user3
end
- describe '#set_attributes' do
- it 'sends info emails correctly' do
+ describe "#set_attributes" do
+ it "sends info emails correctly" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today)
- # note: mail to two submitters is counted as one mail
+ # NOTE: mail to two submitters is counted as one mail
expect do
cleaner.clean!
end.to change { ActionMailer::Base.deliveries.count }.by(3)
end
- it 'sends info and reminder emails correctly' do
+ it "sends info and reminder emails correctly" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 7.days)
@@ -69,7 +66,7 @@
end.to change { ActionMailer::Base.deliveries.count }.by(5)
end
- it 'sends deletion emails correctly (example 1)' do
+ it "sends deletion emails correctly (example 1)" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 14.days)
@@ -78,7 +75,7 @@
end.to change { ActionMailer::Base.deliveries.count }.by(5)
end
- it 'sends deletion emails correctly (example 2)' do
+ it "sends deletion emails correctly (example 2)" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 21.days)
@@ -88,8 +85,8 @@
end
end
- describe '#clean!' do
- it 'destroys submissions correctly (example 1)' do
+ describe "#clean!" do
+ it "destroys submissions correctly (example 1)" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 14.days)
cleaner.clean!
@@ -97,7 +94,7 @@
expect(Submission.all.size).to be(1)
end
- it 'destroys submissions correctly (example 2)' do
+ it "destroys submissions correctly (example 2)" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 21.days)
cleaner.clean!
@@ -105,7 +102,7 @@
expect(Submission.all.size).to be(2)
end
- it 'does not destroy submissions if no assignments to be deleted' do
+ it "does not destroy submissions if no assignments to be deleted" do
cleaner = FactoryBot.build(:submission_cleaner,
date: Time.zone.today + 20.days)
cleaner.clean!
diff --git a/spec/models/submission_spec.rb b/spec/models/submission_spec.rb
index ff9144967..e17fbd6d5 100644
--- a/spec/models/submission_spec.rb
+++ b/spec/models/submission_spec.rb
@@ -1,23 +1,21 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Submission, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Submission, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_submission)).to be_valid
end
# test validations
- it 'is invalid without an assignment' do
+ it "is invalid without an assignment" do
expect(FactoryBot.build(:valid_submission, assignment: nil)).to be_invalid
end
- it 'is invalid without a tutorial' do
+ it "is invalid without a tutorial" do
expect(FactoryBot.build(:valid_submission, tutorial: nil)).to be_invalid
end
- it 'is invalid if lecture does not match' do
+ it "is invalid if lecture does not match" do
submission = FactoryBot.build(:valid_submission)
submission.assignment.lecture = FactoryBot.build(:lecture)
expect(submission).to be_invalid
@@ -25,42 +23,42 @@
# test traits
- describe 'with assignment' do
- it 'has an assignment' do
+ describe "with assignment" do
+ it "has an assignment" do
submission = FactoryBot.build(:valid_submission, :with_assignment)
expect(submission.assignment).to be_kind_of(Assignment)
end
end
- describe 'with tutorial' do
- it 'has a tutorial' do
+ describe "with tutorial" do
+ it "has a tutorial" do
submission = FactoryBot.build(:valid_submission, :with_tutorial)
expect(submission.tutorial).to be_kind_of(Tutorial)
end
end
- describe 'with users' do
- it 'has two users' do
+ describe "with users" do
+ it "has two users" do
submission = FactoryBot.build(:valid_submission, :with_users)
- expect(submission.users.size).to eq 2
+ expect(submission.users.size).to eq(2)
end
- it 'has the correct number of users when users_count parameter is used' do
+ it "has the correct number of users when users_count parameter is used" do
submission = FactoryBot.build(:valid_submission, :with_users,
users_count: 4)
- expect(submission.users.size).to eq 4
+ expect(submission.users.size).to eq(4)
end
end
- describe 'with manuscript' do
- it 'has a manuscript' do
+ describe "with manuscript" do
+ it "has a manuscript" do
submission = FactoryBot.build(:valid_submission, :with_manuscript)
expect(submission.manuscript)
.to be_kind_of(SubmissionUploader::UploadedFile)
end
end
- describe 'with correction' do
- it 'has a correction' do
+ describe "with correction" do
+ it "has a correction" do
submission = FactoryBot.build(:valid_submission, :with_correction)
expect(submission.correction)
.to be_kind_of(CorrectionUploader::UploadedFile)
diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb
index 6b6fa8e58..7a458c3f7 100644
--- a/spec/models/tag_spec.rb
+++ b/spec/models/tag_spec.rb
@@ -1,51 +1,49 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Tag, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Tag, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:tag)).to be_valid
end
# test validations - INCOMPLETE
- it 'is invalid if it has no notions' do
+ it "is invalid if it has no notions" do
tag = Tag.new
expect(tag).to be_invalid
end
# test traits
- describe 'with several notions' do
- it 'has the correct number of notions' do
+ describe "with several notions" do
+ it "has the correct number of notions" do
tag = FactoryBot.build(:tag, :with_several_notions, notions_count: 3)
- expect(tag.notions.size).to eq 3
+ expect(tag.notions.size).to eq(3)
end
- it 'has one notion if no notions_count parameter is given' do
+ it "has one notion if no notions_count parameter is given" do
tag = FactoryBot.build(:tag, :with_several_notions)
- expect(tag.notions.size).to eq 1
+ expect(tag.notions.size).to eq(1)
end
end
- describe 'with related tags' do
- it 'has the correct number of related tags' do
+ describe "with related tags" do
+ it "has the correct number of related tags" do
tag = FactoryBot.build(:tag, :with_related_tags, related_tags_count: 3)
- expect(tag.related_tags.size).to eq 3
+ expect(tag.related_tags.size).to eq(3)
end
- it 'has two related tags if no related_tags_count parameter is given' do
+ it "has two related tags if no related_tags_count parameter is given" do
tag = FactoryBot.build(:tag, :with_related_tags)
- expect(tag.related_tags.size).to eq 2
+ expect(tag.related_tags.size).to eq(2)
end
end
- describe 'with courses' do
- it 'has the correct number of courses' do
+ describe "with courses" do
+ it "has the correct number of courses" do
tag = FactoryBot.build(:tag, :with_courses, courses_count: 3)
- expect(tag.courses.size).to eq 3
+ expect(tag.courses.size).to eq(3)
end
- it 'has two courses if no courses_count parameter is given' do
+ it "has two courses if no courses_count parameter is given" do
tag = FactoryBot.build(:tag, :with_courses)
- expect(tag.courses.size).to eq 2
+ expect(tag.courses.size).to eq(2)
end
end
diff --git a/spec/models/talk_spec.rb b/spec/models/talk_spec.rb
index 7237e03ab..a18242241 100644
--- a/spec/models/talk_spec.rb
+++ b/spec/models/talk_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Talk, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Talk, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:valid_talk)).to be_valid
end
# Test validations
- it 'is invalid without a lecture' do
+ it "is invalid without a lecture" do
talk = FactoryBot.build(:valid_talk)
talk.lecture = nil
expect(talk).to be_invalid
end
- it 'is invalid without a title' do
+ it "is invalid without a title" do
talk = FactoryBot.build(:valid_talk)
talk.title = nil
expect(talk).to be_invalid
@@ -21,143 +19,146 @@
# Test traits
- describe 'talk with date' do
+ describe "talk with date" do
before(:all) do
@talk = FactoryBot.build(:valid_talk, :with_date)
end
- it 'is valid' do
+ it "is valid" do
expect(@talk).to be_valid
end
- it 'has a date' do
+ it "has a date" do
expect(@talk.dates.first).to be_kind_of(Date)
end
end
- describe 'talk with speaker' do
+ describe "talk with speaker" do
before(:all) do
@talk = FactoryBot.build(:valid_talk, :with_speaker)
end
- it 'is valid' do
+ it "is valid" do
expect(@talk).to be_valid
end
- it 'has a speaker' do
+ it "has a speaker" do
expect(@talk.speakers).not_to be_nil
end
end
# Test methods
- describe '#talk' do
- it 'returns itself' do
+ describe "#talk" do
+ it "returns itself" do
talk = FactoryBot.build(:talk)
- expect(talk.talk).to eq talk
+ expect(talk.talk).to eq(talk)
end
end
- describe '#lesson' do
- it 'returns nil' do
+ describe "#lesson" do
+ it "returns nil" do
talk = FactoryBot.build(:talk)
expect(talk.lesson).to be_nil
end
end
- context 'title methods' do
+ context "title methods" do
before :all do
- I18n.locale = 'de'
- course = FactoryBot.build(:course, title: 'Algebra 1',
- short_title: 'Alg1')
- term = FactoryBot.build(:term, season: 'SS', year: 2020)
- lecture = FactoryBot.build(:lecture, course: course, term: term)
- FactoryBot.create(:talk, lecture: lecture, title: 'total bs')
- @talk = FactoryBot.create(:talk, lecture: lecture,
- title: 'even more bs')
+ I18n.with_locale(:de) do
+ course = FactoryBot.build(:course, title: "Algebra 1",
+ short_title: "Alg1")
+ term = FactoryBot.build(:term, season: "SS", year: 2020)
+ lecture = FactoryBot.build(:lecture, course: course, term: term)
+ FactoryBot.create(:talk, lecture: lecture, title: "total bs")
+ @talk = FactoryBot.create(:talk, lecture: lecture,
+ title: "even more bs")
+ end
end
- describe '#to_label' do
- it 'returns the correct label' do
- I18n.locale = 'de'
- expect(@talk.to_label).to eq 'Vortrag 2. even more bs'
+ describe "#to_label" do
+ it "returns the correct label" do
+ I18n.with_locale(:de) do
+ expect(@talk.to_label).to eq("Vortrag 2. even more bs")
+ end
end
end
- describe '#title_for_viewers' do
- it 'returns the correct title' do
+ describe "#title_for_viewers" do
+ it "returns the correct title" do
expect(@talk.title_for_viewers)
- .to eq '(V) Alg1 SS 20, Vortrag 2. even more bs'
+ .to eq("(V) Alg1 SS 20, Vortrag 2. even more bs")
end
end
- describe '#long_title' do
- it 'returns the correct title' do
+ describe "#long_title" do
+ it "returns the correct title" do
expect(@talk.long_title)
- .to eq '(V) Alg1 SS 20, Vortrag 2. even more bs'
+ .to eq("(V) Alg1 SS 20, Vortrag 2. even more bs")
end
end
- describe '#local_title_for_viewers' do
- it 'returns the correct title' do
+ describe "#local_title_for_viewers" do
+ it "returns the correct title" do
expect(@talk.local_title_for_viewers)
- .to eq 'Vortrag 2. even more bs'
+ .to eq("Vortrag 2. even more bs")
end
end
- describe '#short_title_with_lecture_date' do
- it 'returns the correct title' do
+ describe "#short_title_with_lecture_date" do
+ it "returns the correct title" do
expect(@talk.short_title_with_lecture_date)
- .to eq '(V) Alg1 SS 20, Vortrag 2. even more bs'
+ .to eq("(V) Alg1 SS 20, Vortrag 2. even more bs")
end
end
- describe '#card_header' do
- it 'returns the correct title' do
+ describe "#card_header" do
+ it "returns the correct title" do
expect(@talk.card_header)
- .to eq '(V) Alg1 SS 20, Vortrag 2. even more bs'
+ .to eq("(V) Alg1 SS 20, Vortrag 2. even more bs")
end
end
- describe '#compact_title' do
- it 'returns the correct compact title' do
- expect(@talk.compact_title).to eq 'V.Alg1.SS20.V2'
+ describe "#compact_title" do
+ it "returns the correct compact title" do
+ expect(@talk.compact_title).to eq("V.Alg1.SS20.V2")
end
end
end
- describe '#given_by?' do
- it 'returns true if the user is a speaker of the talk' do
+ describe "#given_by?" do
+ it "returns true if the user is a speaker of the talk" do
talk = FactoryBot.build(:valid_talk)
user = FactoryBot.build(:confirmed_user)
talk.speakers << user
- expect(talk.given_by?(user)).to be true
+ expect(talk.given_by?(user)).to be(true)
end
end
- context 'locale methods' do
+ context "locale methods" do
before :all do
- I18n.locale = 'de'
- course = FactoryBot.build(:course, title: 'Algebra 1',
- short_title: 'Alg1')
- term = FactoryBot.build(:term, season: 'SS', year: 2020)
- lecture = FactoryBot.build(:lecture, course: course, term: term,
- locale: 'br')
- @talk = FactoryBot.create(:talk, lecture: lecture)
+ I18n.with_locale(:de) do
+ course = FactoryBot.build(:course, title: "Algebra 1",
+ short_title: "Alg1")
+ term = FactoryBot.build(:term, season: "SS", year: 2020)
+ lecture = FactoryBot.build(:lecture, course: course, term: term,
+ locale: "br")
+ @talk = FactoryBot.create(:talk, lecture: lecture)
+ end
end
- describe '#locale' do
- it 'returns the locale of the lecture' do
- expect(@talk.locale).to eq 'br'
+ describe "#locale" do
+ it "returns the locale of the lecture" do
+ expect(@talk.locale).to eq("br")
end
end
end
- describe '#media_scope' do
- it 'returns the lecture associated to the talk' do
- lecture = FactoryBot.build(:lecture, released: 'all')
+ describe "#media_scope" do
+ it "returns the lecture associated to the talk" do
+ lecture = FactoryBot.build(:lecture, released: "all")
talk = FactoryBot.build(:talk, lecture: lecture)
- expect(talk.media_scope).to eq lecture
+ expect(talk.media_scope).to eq(lecture)
end
end
- context 'position methods' do
+ context "position methods" do
before :all do
lecture = FactoryBot.build(:lecture)
@talk1 = FactoryBot.create(:talk, lecture: lecture)
@@ -165,59 +166,59 @@
@talk3 = FactoryBot.create(:talk, lecture: lecture)
end
- describe '#number' do
- it 'returns the number of the talk' do
- expect(@talk3.number).to eq 3
+ describe "#number" do
+ it "returns the number of the talk" do
+ expect(@talk3.number).to eq(3)
end
end
- describe '#previous' do
- it 'returns the previous talk if the talk is not the first one' do
- expect(@talk3.previous).to eq @talk2
+ describe "#previous" do
+ it "returns the previous talk if the talk is not the first one" do
+ expect(@talk3.previous).to eq(@talk2)
end
- it 'returns nil if the talk is the first one' do
- expect(@talk1.previous).to be nil
+ it "returns nil if the talk is the first one" do
+ expect(@talk1.previous).to be(nil)
end
end
- describe '#next' do
- it 'returns the next talk if the talk is not the last one' do
- expect(@talk2.next).to eq @talk3
+ describe "#next" do
+ it "returns the next talk if the talk is not the last one" do
+ expect(@talk2.next).to eq(@talk3)
end
- it 'returns nil if the talk is the last one' do
- expect(@talk3.next).to be nil
+ it "returns nil if the talk is the last one" do
+ expect(@talk3.next).to be(nil)
end
end
- describe '#proper_media' do
- it 'returns the array of media associated to the talk that are neither '\
- 'Questions nor Remarks' do
+ describe "#proper_media" do
+ it "returns the array of media associated to the talk that are neither " \
+ "Questions nor Remarks" do
talk = FactoryBot.create(:valid_talk)
medium1 = FactoryBot.create(:talk_medium, teachable: talk,
- sort: 'Kaviar')
+ sort: "Kaviar")
medium2 = FactoryBot.create(:talk_medium, teachable: talk,
- sort: 'Sesam')
- medium3 = FactoryBot.create(:talk_medium, teachable: talk,
- sort: 'Question')
- medium4 = FactoryBot.create(:talk_medium, teachable: talk,
- sort: 'Remark')
+ sort: "Sesam")
+ FactoryBot.create(:talk_medium, teachable: talk,
+ sort: "Question")
+ FactoryBot.create(:talk_medium, teachable: talk,
+ sort: "Remark")
expect(talk.proper_media).to match_array([medium1, medium2])
end
end
- describe '#card_header_path' do
- it 'returns the path for the talk if the user is subscribed to the '\
- 'seminar' do
+ describe "#card_header_path" do
+ it "returns the path for the talk if the user is subscribed to the " \
+ "seminar" do
lecture = FactoryBot.build(:lecture)
user = FactoryBot.create(:confirmed_user)
user.lectures << lecture
talk = FactoryBot.create(:valid_talk, lecture: lecture)
- expect(talk.card_header_path(user)).to include('talks/')
+ expect(talk.card_header_path(user)).to include("talks/")
end
- it 'returns nil if user is not subscribed to the seminar' do
+ it "returns nil if user is not subscribed to the seminar" do
lecture = FactoryBot.build(:lecture)
user = FactoryBot.create(:confirmed_user)
talk = FactoryBot.create(:valid_talk, lecture: lecture)
@@ -225,4 +226,4 @@
end
end
end
-end
\ No newline at end of file
+end
diff --git a/spec/models/talk_tag_join_spec.rb b/spec/models/talk_tag_join_spec.rb
index 9b80b81ae..1b5e7edeb 100644
--- a/spec/models/talk_tag_join_spec.rb
+++ b/spec/models/talk_tag_join_spec.rb
@@ -1,5 +1,5 @@
-require 'rails_helper'
+require "rails_helper"
-RSpec.describe TalkTagJoin, type: :model do
+RSpec.describe(TalkTagJoin, type: :model) do
pending "add some examples to (or delete) #{__FILE__}"
end
diff --git a/spec/models/teachable_parser_spec.rb b/spec/models/teachable_parser_spec.rb
index 13a685fbb..7068fb2ba 100644
--- a/spec/models/teachable_parser_spec.rb
+++ b/spec/models/teachable_parser_spec.rb
@@ -1,11 +1,9 @@
-# frozen_string_literal: true
-
-RSpec.describe TeachableParser, type: :model do
- it 'has a valid factory' do
+RSpec.describe(TeachableParser, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:teachable_parser)).to be_kind_of(TeachableParser)
end
- describe '#teachables_as_strings' do
+ describe "#teachables_as_strings" do
before :all do
DatabaseCleaner.clean
course1 = FactoryBot.create(:course)
@@ -24,36 +22,36 @@
@lesson1_str = "Lesson-#{lesson1.id}"
end
- it 'returns [] if :all_teachables flag is set' do
+ it "returns [] if :all_teachables flag is set" do
teachable_parser = FactoryBot.build(:teachable_parser,
- all_teachables: '1')
+ all_teachables: "1")
expect(teachable_parser.teachables_as_strings).to eq([])
end
- it 'returns the given teachable strings if teachable_inheritance flag'\
- 'is not set' do
+ it "returns the given teachable strings if teachable_inheritance flag" \
+ "is not set" do
teachable_parser = FactoryBot.build(:teachable_parser,
teachable_ids: [@course1_str],
- teachable_inheritance: '0')
+ teachable_inheritance: "0")
expect(teachable_parser.teachables_as_strings)
.to eq([@course1_str])
end
- it 'returns inherited teachables as strings if teachable_inheritance'\
- 'flag is set (#1)' do
+ it "returns inherited teachables as strings if teachable_inheritance" \
+ "flag is set (#1)" do
teachable_parser = FactoryBot.build(:teachable_parser,
teachable_ids: [@course1_str],
- teachable_inheritance: '1')
+ teachable_inheritance: "1")
expect(teachable_parser.teachables_as_strings)
.to match_array([@course1_str, @lecture1_str, @lecture2_str,
@lesson1_str])
end
- it 'returns all selected lectures and their lessons' do
+ it "returns all selected lectures and their lessons" do
teachable_parser = FactoryBot.build(:teachable_parser,
teachable_ids:
[@lecture1_str, @lecture2_str],
- teachable_inheritance: '1')
+ teachable_inheritance: "1")
expect(teachable_parser.teachables_as_strings)
.to match_array([@lecture1_str, @lecture2_str, @lesson1_str])
end
diff --git a/spec/models/term_spec.rb b/spec/models/term_spec.rb
index cf13f4015..5806d9eb6 100644
--- a/spec/models/term_spec.rb
+++ b/spec/models/term_spec.rb
@@ -1,55 +1,53 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Term, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Term, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:term)).to be_valid
end
# test validations
- it 'is invalid without a season' do
+ it "is invalid without a season" do
term = FactoryBot.build(:term, season: nil)
expect(term).to be_invalid
end
- it 'is invalid without a year' do
+ it "is invalid without a year" do
term = FactoryBot.build(:term, year: nil)
expect(term).to be_invalid
end
- it 'is invalid if season is not SS or WS' do
- term = FactoryBot.build(:term, season: 'Spring')
+ it "is invalid if season is not SS or WS" do
+ term = FactoryBot.build(:term, season: "Spring")
expect(term).to be_invalid
end
- it 'is invalid if year is not a number' do
- term = FactoryBot.build(:term, year: 'hello')
+ it "is invalid if year is not a number" do
+ term = FactoryBot.build(:term, year: "hello")
expect(term).to be_invalid
end
- it 'is invalid if year is not an integer' do
+ it "is invalid if year is not an integer" do
term = FactoryBot.build(:term, year: 2017.25)
expect(term).to be_invalid
end
- it 'is invalid if year is lower than 2000' do
+ it "is invalid if year is lower than 2000" do
term = FactoryBot.build(:term, year: 1999)
expect(term).to be_invalid
end
- it 'is invalid with duplicate season and year' do
- FactoryBot.create(:term, season: 'SS', year: 2017)
- term = FactoryBot.build(:term, season: 'SS', year: 2017)
+ it "is invalid with duplicate season and year" do
+ FactoryBot.create(:term, season: "SS", year: 2017)
+ term = FactoryBot.build(:term, season: "SS", year: 2017)
expect(term).to be_invalid
end
# test traits
- describe 'summer term' do
+ describe "summer term" do
before :all do
@term = FactoryBot.build(:term, :summer)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@term).to be_valid
end
- it 'is a summer term' do
- expect(@term.season).to eq 'SS'
+ it "is a summer term" do
+ expect(@term.season).to eq("SS")
end
end
diff --git a/spec/models/time_stamp_spec.rb b/spec/models/time_stamp_spec.rb
index 4c954296a..5573a6016 100644
--- a/spec/models/time_stamp_spec.rb
+++ b/spec/models/time_stamp_spec.rb
@@ -1,24 +1,22 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe TimeStamp, type: :model do
- it 'has a valid factory' do
+RSpec.describe(TimeStamp, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:time_stamp)).to be_valid
end
# test subfactories
- describe 'by string' do
- it 'has a valid factory' do
+ describe "by string" do
+ it "has a valid factory" do
time_stamp = FactoryBot.build(:time_stamp_by_string,
- time_string: '1:17:29.745')
+ time_string: "1:17:29.745")
expect(time_stamp).to be_valid
end
end
- describe 'by hms' do
- it 'has a valid factory' do
+ describe "by hms" do
+ it "has a valid factory" do
time_stamp = FactoryBot.build(:time_stamp_by_hms,
h: 1, m: 17, s: 29, ms: 745)
expect(time_stamp).to be_valid
diff --git a/spec/models/tutor_tutorial_join_spec.rb b/spec/models/tutor_tutorial_join_spec.rb
index f1d4d875d..1ad2f6f3b 100644
--- a/spec/models/tutor_tutorial_join_spec.rb
+++ b/spec/models/tutor_tutorial_join_spec.rb
@@ -1,19 +1,17 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe TutorTutorialJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(TutorTutorialJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:tutor_tutorial_join)).to be_valid
end
# test validations
- it 'is invalid without a tutor' do
+ it "is invalid without a tutor" do
expect(FactoryBot.build(:tutor_tutorial_join, tutor: nil)).to be_invalid
end
- it 'is invalid without a tutorial' do
+ it "is invalid without a tutorial" do
expect(FactoryBot.build(:tutor_tutorial_join, tutorial: nil)).to be_invalid
end
end
diff --git a/spec/models/tutorial_spec.rb b/spec/models/tutorial_spec.rb
index b62ecfe88..25ab39192 100644
--- a/spec/models/tutorial_spec.rb
+++ b/spec/models/tutorial_spec.rb
@@ -1,23 +1,21 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe Tutorial, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Tutorial, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:tutorial)).to be_valid
end
# test validations
- it 'is invalid without a lecture' do
+ it "is invalid without a lecture" do
expect(FactoryBot.build(:tutorial, lecture: nil)).to be_invalid
end
- it 'is invalid without a title' do
+ it "is invalid without a title" do
expect(FactoryBot.build(:tutorial, title: nil)).to be_invalid
end
- it 'is invalid with duplicate title in same lecture' do
+ it "is invalid with duplicate title in same lecture" do
tutorial = FactoryBot.create(:tutorial)
lecture = tutorial.lecture
title = tutorial.title
@@ -27,14 +25,14 @@
# test traits
- describe 'with tutors' do
- it 'has a tutor' do
+ describe "with tutors" do
+ it "has a tutor" do
tutorial = FactoryBot.build(:tutorial, :with_tutors)
- expect(tutorial.tutors.size).to eq 1
+ expect(tutorial.tutors.size).to eq(1)
end
- it 'has the correct number of tutors if tutors_count is supplied' do
+ it "has the correct number of tutors if tutors_count is supplied" do
tutorial = FactoryBot.build(:tutorial, :with_tutors, tutors_count: 3)
- expect(tutorial.tutors.size).to eq 3
+ expect(tutorial.tutors.size).to eq(3)
end
end
end
diff --git a/spec/models/user_cleaner_spec.rb b/spec/models/user_cleaner_spec.rb
index 99cab66c4..4549cfd4c 100644
--- a/spec/models/user_cleaner_spec.rb
+++ b/spec/models/user_cleaner_spec.rb
@@ -1,16 +1,16 @@
-require 'rails_helper'
+require "rails_helper"
-RSpec.describe UserCleaner, type: :model do
- it 'has a factory' do
+RSpec.describe(UserCleaner, type: :model) do
+ it "has a factory" do
expect(FactoryBot.build(:user_cleaner))
.to be_kind_of(UserCleaner)
end
- it 'can destroy users' do
+ it "can destroy users" do
n_users = User.all.size
u = FactoryBot.build(:user_cleaner, :with_hashed_user)
- expect(User.all.size).to eq n_users+1
+ expect(User.all.size).to eq(n_users + 1)
u.delete_ghosts
- expect(User.all.size).to eq n_users
+ expect(User.all.size).to eq(n_users)
end
end
diff --git a/spec/models/user_favorite_lecture_join_spec.rb b/spec/models/user_favorite_lecture_join_spec.rb
index 85c65dce3..1e16510d5 100644
--- a/spec/models/user_favorite_lecture_join_spec.rb
+++ b/spec/models/user_favorite_lecture_join_spec.rb
@@ -1,20 +1,18 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe UserFavoriteLectureJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(UserFavoriteLectureJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:user_favorite_lecture_join)).to be_valid
end
# test validations
- it 'is invalid without a user' do
+ it "is invalid without a user" do
expect(FactoryBot.build(:user_favorite_lecture_join, user: nil))
.to be_invalid
end
- it 'is invalid without a lecture' do
+ it "is invalid without a lecture" do
expect(FactoryBot.build(:user_favorite_lecture_join, lecture: nil))
.to be_invalid
end
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb
index fd9a292b8..cc5dd6d5f 100644
--- a/spec/models/user_spec.rb
+++ b/spec/models/user_spec.rb
@@ -1,56 +1,54 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe User, type: :model do
- it 'has a valid factory' do
+RSpec.describe(User, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:user)).to be_valid
end
# test validations - SOME ARE MISSING
- it 'is invalid if it is persisted and no name is given' do
+ it "is invalid if it is persisted and no name is given" do
user = FactoryBot.create(:confirmed_user)
user.name = nil
expect(user).not_to be_valid
end
- it 'is invalid if homepage is given but with an invalid url' do
+ it "is invalid if homepage is given but with an invalid url" do
user = FactoryBot.build(:confirmed_user)
- user.homepage = 'usual_bs'
+ user.homepage = "usual_bs"
expect(user).not_to be_valid
end
# test traits and subfactories
- describe 'confirmed user' do
- it 'has a valid factory for building' do
+ describe "confirmed user" do
+ it "has a valid factory for building" do
expect(FactoryBot.build(:confirmed_user)).to be_valid
end
- it 'has a valid factory for creating' do
+ it "has a valid factory for creating" do
expect(FactoryBot.create(:confirmed_user)).to be_valid
end
- it 'is confirmed when created' do
+ it "is confirmed when created" do
expect(FactoryBot.create(:confirmed_user).confirmed_at).not_to be_nil
end
end
- describe 'user with subscribed lectures' do
+ describe "user with subscribed lectures" do
before :all do
@user = FactoryBot.build(:user, :with_lectures)
end
- it 'has a valid factory' do
+ it "has a valid factory" do
expect(@user).to be_valid
end
- it 'has subscribed lectures' do
+ it "has subscribed lectures" do
expect(@user.lectures).not_to be_nil
end
- it 'has 2 subscribed lectures when called without lecture_count param' do
- expect(@user.lectures.size).to eq 2
+ it "has 2 subscribed lectures when called without lecture_count param" do
+ expect(@user.lectures.size).to eq(2)
end
- it 'has correct number of lectures when called with lecture_count param' do
+ it "has correct number of lectures when called with lecture_count param" do
user = FactoryBot.build(:user, :with_lectures, lecture_count: 3)
- expect(user.lectures.size).to eq 3
+ expect(user.lectures.size).to eq(3)
end
end
diff --git a/spec/models/user_submission_join_spec.rb b/spec/models/user_submission_join_spec.rb
index 02e6e827b..39419de72 100644
--- a/spec/models/user_submission_join_spec.rb
+++ b/spec/models/user_submission_join_spec.rb
@@ -1,15 +1,13 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe UserSubmissionJoin, type: :model do
- it 'has a valid factory' do
+RSpec.describe(UserSubmissionJoin, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:user_submission_join)).to be_valid
end
# test validations - INCOMPLETE
- it 'is invalid without a user' do
+ it "is invalid without a user" do
expect(FactoryBot.build(:user_submission_join, user: nil)).to be_invalid
end
end
diff --git a/spec/models/vtt_container_spec.rb b/spec/models/vtt_container_spec.rb
index f607e1175..a17118cab 100644
--- a/spec/models/vtt_container_spec.rb
+++ b/spec/models/vtt_container_spec.rb
@@ -1,24 +1,22 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe VttContainer, type: :model do
- it 'has a valid factory' do
+RSpec.describe(VttContainer, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:vtt_container)).to be_valid
end
# test traits
- describe 'with table of contents' do
- it 'has a table of contents' do
+ describe "with table of contents" do
+ it "has a table of contents" do
vtt_container = FactoryBot.build(:vtt_container, :with_table_of_contents)
expect(vtt_container.table_of_contents)
.to be_kind_of(VttUploader::UploadedFile)
end
end
- describe 'with references' do
- it 'has references' do
+ describe "with references" do
+ it "has references" do
vtt_container = FactoryBot.build(:vtt_container, :with_references)
expect(vtt_container.references)
.to be_kind_of(VttUploader::UploadedFile)
diff --git a/spec/models/watchlist_entry_spec.rb b/spec/models/watchlist_entry_spec.rb
index fd4b561da..4e938f777 100644
--- a/spec/models/watchlist_entry_spec.rb
+++ b/spec/models/watchlist_entry_spec.rb
@@ -1,23 +1,23 @@
-require 'rails_helper'
+require "rails_helper"
-RSpec.describe WatchlistEntry, type: :model do
- it 'has a valid factory' do
+RSpec.describe(WatchlistEntry, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:watchlist_entry, :with_watchlist, :with_medium)).to be_valid
end
- it 'must have a medium' do
+ it "must have a medium" do
entry = FactoryBot.build(:watchlist_entry, :with_watchlist)
entry.valid?
- expect(entry.errors[:medium]).to include('muss ausgefüllt werden')
+ expect(entry.errors[:medium]).to include("muss ausgefüllt werden")
end
- it 'must have a watchlist' do
+ it "must have a watchlist" do
entry = FactoryBot.build(:watchlist_entry, :with_medium)
entry.valid?
- expect(entry.errors[:watchlist]).to include('muss ausgefüllt werden')
+ expect(entry.errors[:watchlist]).to include("muss ausgefüllt werden")
end
- it 'can only be once inside a watchlist' do
+ it "can only be once inside a watchlist" do
entry = FactoryBot.create(:watchlist_entry, :with_watchlist, :with_medium)
second_entry = WatchlistEntry.new(watchlist: entry.watchlist, medium: entry.medium)
expect(second_entry).to be_invalid
diff --git a/spec/models/watchlist_spec.rb b/spec/models/watchlist_spec.rb
index d26f4d28a..5c511bf37 100644
--- a/spec/models/watchlist_spec.rb
+++ b/spec/models/watchlist_spec.rb
@@ -1,33 +1,33 @@
-require 'rails_helper'
+require "rails_helper"
-RSpec.describe Watchlist, type: :model do
- it 'has a valid factory' do
+RSpec.describe(Watchlist, type: :model) do
+ it "has a valid factory" do
expect(FactoryBot.build(:watchlist, :with_user)).to be_valid
end
- it 'must have a name' do
+ it "must have a name" do
watchlist = Watchlist.new(name: nil)
watchlist.valid?
- expect(watchlist.errors[:name]).to include('muss ausgefüllt werden')
+ expect(watchlist.errors[:name]).to include("muss ausgefüllt werden")
end
- it 'must have a unique name' do
+ it "must have a unique name" do
first_watchlist = FactoryBot.create(:watchlist, :with_user)
- second_watchlist = Watchlist.new(user_id: first_watchlist.user_id, name:first_watchlist.name)
+ second_watchlist = Watchlist.new(user_id: first_watchlist.user_id, name: first_watchlist.name)
expect(second_watchlist).to be_invalid
end
- it 'can be public' do
+ it "can be public" do
watchlist = FactoryBot.build(:watchlist, :with_user)
watchlist.public = true
- expect(watchlist.public).to eq true
+ expect(watchlist.public).to eq(true)
end
- it 'ownership can be tested' do
+ it "ownership can be tested" do
watchlist = FactoryBot.build(:watchlist, :with_user)
user = FactoryBot.build(:user)
- expect(watchlist.owned_by?(user)).to eq false
- expect(watchlist.owned_by?(watchlist.user)).to eq true
+ expect(watchlist.owned_by?(user)).to eq(false)
+ expect(watchlist.owned_by?(watchlist.user)).to eq(true)
end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 34043b89a..1c4c94a3f 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -1,14 +1,12 @@
-# frozen_string_literal: true
-
# This file is copied to spec/ when you run 'rails generate rspec:install'
-require 'spec_helper'
-require File.expand_path('../../config/environment', __FILE__)
+require "spec_helper"
+require File.expand_path("../config/environment", __dir__)
# Prevent database truncation if the environment is production
-abort('The Rails env is running in production mode!') if Rails.env.production?
-require 'rspec/rails'
-require 'devise'
+abort("The Rails env is running in production mode!") if Rails.env.production?
+require "rspec/rails"
+require "devise"
# Add additional requires below this line. Rails is not loaded until this point!
-require 'support/database_cleaner'
+require "support/database_cleaner"
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
diff --git a/spec/requests/media_spec.rb b/spec/requests/media_spec.rb
index d9e6dab29..5f9a62277 100644
--- a/spec/requests/media_spec.rb
+++ b/spec/requests/media_spec.rb
@@ -1,76 +1,85 @@
-require 'rails_helper'
-
-RSpec.describe "Media", type: :request do
+require "rails_helper"
+RSpec.describe("Media", type: :request) do
describe "#search_by" do
before do
Medium.destroy_all
-
- @medium1 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, sort: 'Nuesse', description: 'Erstes Medium')
- @medium2 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, sort: 'Nuesse', description: 'Zweites Medium')
- @medium3 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, sort: 'Quiz', description: 'Drittes Medium')
- @medium4 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, :with_tags, sort: 'Nuesse', description: 'Getagtes Medium')
- @medium5 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, :with_tags, sort: 'Nuesse', description: 'Anderes Medium')
+
+ @medium1 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ sort: "Nuesse", description: "Erstes Medium")
+ @medium2 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ sort: "Nuesse", description: "Zweites Medium")
+ @medium3 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ sort: "Quiz", description: "Drittes Medium")
+ @medium4 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ :with_tags, sort: "Nuesse", description: "Getagtes Medium")
+ @medium5 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ :with_tags, sort: "Nuesse", description: "Anderes Medium")
@lecture1 = FactoryBot.create(:lecture)
- @medium6 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, teachable: @lecture1, sort: 'Nuesse', description: 'Erstes Medium mit Lehrer')
+ @medium6 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ teachable: @lecture1, sort: "Nuesse",
+ description: "Erstes Medium mit Lehrer")
@lecture2 = FactoryBot.create(:lecture, teacher: @lecture1.teacher)
- @medium7 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released, teachable: @lecture2, sort: 'Nuesse', description: 'Zweites Medium mit Lehrer')
- @medium8 = FactoryBot.create(:medium, :with_teachable, :with_editors, sort: 'Nuesse', description: 'Unveröffentlichtes Medium')
-
+ @medium7 = FactoryBot.create(:medium, :with_teachable, :with_editors, :released,
+ teachable: @lecture2, sort: "Nuesse",
+ description: "Zweites Medium mit Lehrer")
+ @medium8 = FactoryBot.create(:medium, :with_teachable, :with_editors,
+ sort: "Nuesse", description: "Unveröffentlichtes Medium")
+
sign_in FactoryBot.create(:confirmed_user)
User.last.subscribe_lecture!(@lecture1)
Medium.reindex
-
+
@params = {
search: {
all_types: 1,
all_tags: 1,
- tag_operator: 'or',
+ tag_operator: "or",
all_teachers: 1,
lecture_option: 0,
- fulltext: '',
+ fulltext: "",
per: 6,
- purpose: 'media',
+ purpose: "media",
results_as_list: false
}
}
end
- it 'can search for all (released) media' do
+ it "can search for all (released) media" do
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
expect(response.body).not_to include("Unveröffentlichtes Medium")
hits = parse_media_search(response)
- expect(hits).to eq(Medium.where(released: 'all').size)
+ expect(hits).to eq(Medium.where(released: "all").size)
end
- it 'can search for media by title' do
- @params[:search][:fulltext] = 'Erstes'
+ it "can search for media by title" do
+ @params[:search][:fulltext] = "Erstes"
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
expect(response.body).to include("Erstes Medium")
hits = parse_media_search(response)
expect(hits).to eq(2)
end
- it 'can search for media by sort' do
+ it "can search for media by sort" do
@params[:search][:all_types] = 0
- @params[:search][:types] = ['Quiz']
+ @params[:search][:types] = ["Quiz"]
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
expect(response.body).to include("Drittes Medium")
hits = parse_media_search(response)
expect(hits).to eq(1)
end
- it 'can search for media by tag' do
+ it "can search for media by tag" do
@params[:search][:all_tags] = 0
- @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
+ @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
get media_search_path, params: @params
expect(response.body).not_to include("The search has not returned any hits")
@@ -81,22 +90,22 @@
it 'can do combined search with tagoperator "or" and description' do
@params[:search][:all_tags] = 0
- @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
- @params[:search][:fulltext] = 'Medium'
+ @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
+ @params[:search][:fulltext] = "Medium"
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
hits = parse_media_search(response)
- expect(hits).to eq(Medium.where(released: 'all').size)
+ expect(hits).to eq(Medium.where(released: "all").size)
end
it 'can do search with tagoperator "and" and description' do
- @params[:search][:tag_operator] = 'and'
+ @params[:search][:tag_operator] = "and"
@params[:search][:all_tags] = 0
- @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
- @params[:search][:fulltext] = 'Medium'
+ @params[:search][:tag_ids] = @medium4.tags.pluck(:id)
+ @params[:search][:fulltext] = "Medium"
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
expect(response.body).to include("Getagtes Medium")
hits = parse_media_search(response)
@@ -104,15 +113,15 @@
end
it 'can search for all media with tags by using tagoperator "and"' do
- @params[:search][:tag_operator] = 'and'
+ @params[:search][:tag_operator] = "and"
get media_search_path, params: @params
-
+
expect(response.body).not_to include("The search has not returned any hits")
hits = parse_media_search(response)
expect(hits).to eq(2)
end
- it 'can search by teacher' do
+ it "can search by teacher" do
@params[:search][:all_teachers] = 0
@params[:search][:teacher_ids] = [@lecture1.teacher.id]
get media_search_path, params: @params
@@ -122,7 +131,7 @@
expect(hits).to eq(2)
end
- it 'can search for media of subscribed lectures' do
+ it "can search for media of subscribed lectures" do
@params[:search][:lecture_option] = 1
get media_search_path, params: @params
@@ -132,7 +141,7 @@
expect(hits).to eq(1)
end
- it 'can search for media of custom lecture' do
+ it "can search for media of custom lecture" do
@params[:search][:lecture_option] = 2
@params[:search][:media_lectures] = [@lecture2.id]
get media_search_path, params: @params
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index cb8882a5a..76bfc7b82 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,12 +1,10 @@
-# frozen_string_literal: true
-
-ENV['RAILS_ENV'] ||= 'test'
+ENV["RAILS_ENV"] ||= "test"
# simplecov
-require 'simplecov-cobertura'
+require "simplecov-cobertura"
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
-require 'simplecov'
+require "simplecov"
SimpleCov.start
# This file was generated by the `rails generate rspec:install` command.
@@ -30,7 +28,7 @@
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
- config.expect_with :rspec do |expectations|
+ config.expect_with(:rspec) do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
@@ -43,7 +41,7 @@
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
- config.mock_with :rspec do |mocks|
+ config.mock_with(:rspec) do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
diff --git a/spec/support/database_cleaner.rb b/spec/support/database_cleaner.rb
index fae084409..36ccc0309 100644
--- a/spec/support/database_cleaner.rb
+++ b/spec/support/database_cleaner.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
-
RSpec.configure do |config|
config.before(:suite) do
- DatabaseCleaner.clean_with :truncation, except: %w(ar_internal_metadata)
+ DatabaseCleaner.clean_with(:truncation, except: ["ar_internal_metadata"])
end
config.before(:each) do
diff --git a/spec/support/devise_request_helper.rb b/spec/support/devise_request_helper.rb
index 192c07214..3f5a7884a 100644
--- a/spec/support/devise_request_helper.rb
+++ b/spec/support/devise_request_helper.rb
@@ -1,5 +1,4 @@
module DeviseRequestSpecHelpers
-
include Warden::Test::Helpers
def sign_in(resource_or_scope, resource = nil)
@@ -7,14 +6,13 @@ def sign_in(resource_or_scope, resource = nil)
scope = Devise::Mapping.find_scope!(resource_or_scope)
login_as(resource, scope: scope)
end
-
+
def sign_out(resource_or_scope)
scope = Devise::Mapping.find_scope!(resource_or_scope)
logout(scope)
end
-
end
RSpec.configure do |config|
config.include DeviseRequestSpecHelpers, type: :request
-end
\ No newline at end of file
+end
diff --git a/spec/support/request_parse_helper.rb b/spec/support/request_parse_helper.rb
index 34dee4bb9..5a541afce 100644
--- a/spec/support/request_parse_helper.rb
+++ b/spec/support/request_parse_helper.rb
@@ -1,27 +1,26 @@
module RequestParsingHelper
-
# Parse the request body as HTML and return the number of hits
def parse_media_search(response)
- searchResults = response.body.match(/(?<=searchResults.innerHTML = ').*(?=';)/)[0].gsub('\n', '')
- # strip whitespaces in searchResults
- searchResults = searchResults.gsub(/\s+/, " ")
- # fix " in searchResults
- searchResults = searchResults.gsub(/\\\"/, '"')
- # fix \/ in searchResults
- searchResults = searchResults.gsub('\\/', '/')
-
- # parse searchResults as html
- searchResults = Nokogiri::HTML(searchResults)
-
+ search_results = response.body
+ .match(/(?<=search_results.innerHTML = ').*(?=';)/)[0]
+ .gsub('\n', "")
+ # strip whitespaces in search_results
+ search_results = search_results.gsub(/\s+/, " ")
+ # fix " in search_results
+ search_results = search_results.gsub('\\\"', '"')
+ # fix \/ in search_results
+ search_results = search_results.gsub('\\/', "/")
+
+ # parse search_results as html
+ search_results = Nokogiri::HTML(search_results)
+
# get text within first "col-12 col-lg-2" div
- treffer = searchResults.css('div.col-12.col-lg-2').first.text
- # get number in treffer
- treffer = treffer.match(/\d+/)[0].to_i
- treffer
+ matches = search_results.css("div.col-12.col-lg-2").first.text
+ # get number in matches
+ matches.match(/\d+/)[0].to_i
end
-
end
RSpec.configure do |config|
-config.include RequestParsingHelper, type: :request
-end
\ No newline at end of file
+ config.include RequestParsingHelper, type: :request
+end
diff --git a/spec/support/simplecov_helper.rb b/spec/support/simplecov_helper.rb
index aa91df12a..9d41a0f2f 100644
--- a/spec/support/simplecov_helper.rb
+++ b/spec/support/simplecov_helper.rb
@@ -1,39 +1,37 @@
-# frozen_string_literal: true
-
# spec/support/simplecov_helper.rb
# Credit goes to https://gitlab.com/gitlab-org/gitlab-foss/blob/master/spec/simplecov_env.rb
-require 'simplecov'
-require 'active_support/core_ext/numeric/time'
+require "simplecov"
+require "active_support/core_ext/numeric/time"
module SimpleCovHelper
def self.configure_profile
SimpleCov.configure do
- load_profile 'test_frameworks'
- track_files '{app,lib,config}/**/*.rb'
- track_files 'db/seeds.rb'
-
- add_filter '/vendor/ruby/'
- add_filter 'spec/'
-
- add_group 'Libraries', 'lib'
- add_group 'Assets', 'app/assets'
- add_group 'Channels', 'app/channels'
- add_group 'Netzke Components', 'app/components'
- add_group 'Controllers', 'app/controllers'
- add_group 'Helpers', 'app/helpers'
- add_group 'Jobs', 'app/jobs'
- add_group 'Models', 'app/models'
- add_group 'Services', 'app/services'
- add_group 'Views', 'app/views'
-
- use_merging true
- merge_timeout 5.days
+ load_profile("test_frameworks")
+ track_files("{app,lib,config}/**/*.rb")
+ track_files("db/seeds.rb")
+
+ add_filter("/vendor/ruby/")
+ add_filter("spec/")
+
+ add_group("Libraries", "lib")
+ add_group("Assets", "app/assets")
+ add_group("Channels", "app/channels")
+ add_group("Netzke Components", "app/components")
+ add_group("Controllers", "app/controllers")
+ add_group("Helpers", "app/helpers")
+ add_group("Jobs", "app/jobs")
+ add_group("Models", "app/models")
+ add_group("Services", "app/services")
+ add_group("Views", "app/views")
+
+ use_merging(true)
+ merge_timeout(5.days)
end
end
def self.start!
- return unless ENV['COVERAGE'] == 'true'
+ return unless ENV["COVERAGE"] == "true"
configure_profile
diff --git a/spec/views/chapters/show.html.erb_spec.rb b/spec/views/chapters/show.html.erb_spec.rb
index e47f47154..197c913bb 100644
--- a/spec/views/chapters/show.html.erb_spec.rb
+++ b/spec/views/chapters/show.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'chapters/show.html.erb', type: :view do
+RSpec.describe("chapters/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct title' do
diff --git a/spec/views/courses/show.html.erb_spec.rb b/spec/views/courses/show.html.erb_spec.rb
index 944a57143..f1da02313 100644
--- a/spec/views/courses/show.html.erb_spec.rb
+++ b/spec/views/courses/show.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'courses/show.html.erb', type: :view do
+RSpec.describe("courses/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct title' do
diff --git a/spec/views/lessons/show.html.erb_spec.rb b/spec/views/lessons/show.html.erb_spec.rb
index 2efccb568..8849e77bf 100644
--- a/spec/views/lessons/show.html.erb_spec.rb
+++ b/spec/views/lessons/show.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'lessons/show.html.erb', type: :view do
+RSpec.describe("lessons/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct title' do
diff --git a/spec/views/main/about.html.erb_spec.rb b/spec/views/main/about.html.erb_spec.rb
index d6c9cb274..f233cc6db 100644
--- a/spec/views/main/about.html.erb_spec.rb
+++ b/spec/views/main/about.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'main/about.html.erb', type: :view do
+RSpec.describe("main/about.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'renders correctly' do
diff --git a/spec/views/main/home.html.erb_spec.rb b/spec/views/main/home.html.erb_spec.rb
index 91f6d5f70..073d19d0c 100644
--- a/spec/views/main/home.html.erb_spec.rb
+++ b/spec/views/main/home.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'main/home.html.erb', type: :view do
+RSpec.describe("main/home.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'renders correctly' do
diff --git a/spec/views/media/index.html.erb_spec.rb b/spec/views/media/index.html.erb_spec.rb
index 43d0e0e0a..92c149ca2 100644
--- a/spec/views/media/index.html.erb_spec.rb
+++ b/spec/views/media/index.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'media/show.html.erb', type: :view do
+RSpec.describe("media/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'displays correct information' do
diff --git a/spec/views/media/show.html.erb_spec.rb b/spec/views/media/show.html.erb_spec.rb
index 6d01c9d5d..9cc424ceb 100644
--- a/spec/views/media/show.html.erb_spec.rb
+++ b/spec/views/media/show.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'media/show.html.erb', type: :view do
+RSpec.describe("media/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct title' do
diff --git a/spec/views/profile/edit.html.erb_spec.rb b/spec/views/profile/edit.html.erb_spec.rb
index 1181f7323..100c83a19 100644
--- a/spec/views/profile/edit.html.erb_spec.rb
+++ b/spec/views/profile/edit.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'profile/edit.html.erb', type: :view do
+RSpec.describe("profile/edit.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct profile' do
diff --git a/spec/views/sections/show.html.erb_spec.rb b/spec/views/sections/show.html.erb_spec.rb
index 80ea7139f..9acfb5b07 100644
--- a/spec/views/sections/show.html.erb_spec.rb
+++ b/spec/views/sections/show.html.erb_spec.rb
@@ -1,8 +1,6 @@
-# frozen_string_literal: true
+require "rails_helper"
-require 'rails_helper'
-
-RSpec.describe 'sections/show.html.erb', type: :view do
+RSpec.describe("sections/show.html.erb", type: :view) do
# NEEDS TO BE REFACTORED
# it 'shows the correct title' do
From b42119316ed62b64bc90eff8132944387d77e14a Mon Sep 17 00:00:00 2001
From: Splines <37160523+Splines@users.noreply.github.com>
Date: Tue, 19 Dec 2023 10:54:05 +0100
Subject: [PATCH 2/2] Setup ESLint in order to lint JavaScript (#568)
* Init new ESLint config to lint .js and .js.erb files
* Add default settings/extensions for VSCode
(maybe also something for another PR?)
* Add ESLint to CI/CD
* Introduce dummy changes to see ESLint in action
* Fix wrong fetch depth for checkout action
* Remove unnecessary "--" to pass arguments
* Outsource retrieval of changed files to reusable action
* Correct location of reusable action
* Fix further stuff related to GitHub action
* Clean up GitHub Actions files
* Cache global yarn cache directory
* Remove VSCode specific settings in favor of #569
* Revert "Introduce dummy changes to see ESLint in action"
This reverts commit cdf34734f391c83cac04873a1dbafff2921a6967.
---
.eslintrc.js | 43 ++
.eslintrc.json | 11 -
.github/actions/changed_files/action.yml | 42 ++
.github/workflows/linter.yml | 62 ++-
package.json | 7 +-
yarn.lock | 589 ++++++++++++++++++++++-
6 files changed, 712 insertions(+), 42 deletions(-)
create mode 100644 .eslintrc.js
delete mode 100644 .eslintrc.json
create mode 100644 .github/actions/changed_files/action.yml
diff --git a/.eslintrc.js b/.eslintrc.js
new file mode 100644
index 000000000..8912b06dc
--- /dev/null
+++ b/.eslintrc.js
@@ -0,0 +1,43 @@
+// Starting with v9, this config will be deprecated in favor of the new
+// configuration files [1]. @stylistic is already ready for the new "flat config",
+// when it's time, copy the new config from [2].
+// [1] https://eslint.org/docs/latest/use/configure/configuration-files-new
+// [2] https://eslint.style/guide/config-presets#configuration-factory
+
+// Stylistic Plugin for ESLint
+// see the rules in [3] and [4].
+// [3] https://eslint.style/packages/js#rules
+// [4] https://eslint.org/docs/rules/
+const stylistic = require("@stylistic/eslint-plugin");
+
+const customizedStylistic = stylistic.configs.customize({
+ "indent": 2,
+ "quotes": "double",
+ "jsx": false,
+ "quote-props": "always",
+ "semi": "always",
+ "brace-style": "1tbs",
+});
+
+module.exports = {
+ root: true,
+ parserOptions: {
+ ecmaVersion: 2022,
+ sourceType: "module",
+ },
+ env: {
+ node: true,
+ browser: true,
+ jquery: true,
+ },
+ extends: [
+ "eslint:recommended",
+ // Allow linting of ERB files, see https://github.com/Splines/eslint-plugin-erb
+ "plugin:erb/recommended",
+ ],
+ plugins: ["@stylistic", "erb"],
+ rules: {
+ ...customizedStylistic.rules,
+ "no-unused-vars": "warn",
+ },
+};
diff --git a/.eslintrc.json b/.eslintrc.json
deleted file mode 100644
index c80dac1e1..000000000
--- a/.eslintrc.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "parserOptions": {
- "ecmaVersion": 2017,
- "sourceType": "module",
- "ecmaFeatures": {
- }
- },
- "rules": {
- "semi": "error"
- }
-}
\ No newline at end of file
diff --git a/.github/actions/changed_files/action.yml b/.github/actions/changed_files/action.yml
new file mode 100644
index 000000000..0af0b6e91
--- /dev/null
+++ b/.github/actions/changed_files/action.yml
@@ -0,0 +1,42 @@
+# Why is this file in a subdirectory? Because GitHub Actions requires it to be :(
+# see: https://github.com/orgs/community/discussions/26245#discussioncomment-5962450
+name: "Get changed files"
+description: "Checks out the code and returns the filenames of files that have changed in the pull request"
+
+inputs:
+ file-extensions:
+ # for example: "\.rb$" or something like "\.js$|\.js.erb$"
+ description: "Regex expressions for grep to filter for specific files"
+ required: true
+
+outputs:
+ changed-files:
+ description: "A space-separated list of the files that have changed in the pull request"
+ value: ${{ steps.get-changed-files.outputs.files }}
+
+runs:
+ using: "composite"
+ steps:
+ # This has to be done in the main workflow, not in the action, because
+ # otherwise this reusable action is not available in the workflow.
+ # - name: "Checkout code (on a PR branch)"
+ # uses: actions/checkout@v4
+ # with:
+ # fetch-depth: 2 # to also fetch parent of PR
+
+ # Adapted from this great comment [1]. Git diff adapted from [2].
+ # "|| test $? = 1;" is used to ignore the exit code of grep when no files
+ # are found matching the pattern. For the "three dots" ... syntax, see [3].
+ #
+ # Resources:
+ # number [1] being most important
+ # [1] https://github.com/actions/checkout/issues/520#issuecomment-1167205721
+ # [2] https://robertfaldo.medium.com/commands-to-run-rubocop-and-specs-you-changed-in-your-branch-e6d2f2e4110b
+ # [3] https://community.atlassian.com/t5/Bitbucket-questions/Git-diff-show-different-files-than-PR-Pull-Request/qaq-p/2331786
+ - name: Get changed files
+ shell: bash
+ id: get-changed-files
+ run: |
+ files_pretty=$(git diff --name-only --diff-filter=ACMR -r HEAD^1...HEAD | egrep '${{inputs.file-extensions}}' || test $? = 1;)
+ printf "🎴 Changed files: \n$files_pretty"
+ echo "files=$(echo ${files_pretty} | xargs)" >> $GITHUB_OUTPUT
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index d0652ff32..620283737 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -8,38 +8,62 @@ on:
jobs:
- # Resources:
- # number [1] being most important
- # [1] https://github.com/actions/checkout/issues/520#issuecomment-1167205721
- # [2] https://robertfaldo.medium.com/commands-to-run-rubocop-and-specs-you-changed-in-your-branch-e6d2f2e4110b
- # [3] https://community.atlassian.com/t5/Bitbucket-questions/Git-diff-show-different-files-than-PR-Pull-Request/qaq-p/2331786
rubocop:
- name: RuboCop
+ name: RuboCop (Ruby)
runs-on: ubuntu-latest
steps:
- - name: 'Checkout PR branch (with test merge-commit)'
+ - name: Checkout code
uses: actions/checkout@v4
with:
- fetch-depth: 2 # to also fetch parent of PR
-
- # Adapted from this great comment [1]. Git diff adapted from [2].
- # "|| test $? = 1;" is used to ignore the exit code of grep when no files
- # are found matching the pattern. For the "three dots" ... syntax, see [3].
+ fetch-depth: 2 # to also fetch parent of PR (used to get changed files)
+
- name: Get changed files
- run: |
- files=$(git diff --name-only --diff-filter=ACMR -r HEAD^1...HEAD | grep '\.rb$' || test $? = 1;)
- printf "🎴 Changed ruby files: \n$files"
- echo "CHANGED_FILES=$(echo ${files} | xargs)" >> $GITHUB_ENV
-
+ id: rb-changed
+ uses: ./.github/actions/changed_files/
+ with:
+ file-extensions: \.rb$
+
- name: Set up Ruby 3
- if: env.CHANGED_FILES != ''
+ if: ${{ steps.rb-changed.outputs.changed-files != ''}}
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
bundler-cache: true
- name: Run RuboCop
- if: env.CHANGED_FILES != ''
+ if: ${{ steps.rb-changed.outputs.changed-files != ''}}
run: |
echo "🚨 Running RuboCop version: $(bundle info rubocop | head -1)"
bundle exec rubocop --format github --fail-level 'convention' --force-exclusion -- $CHANGED_FILES
+
+ eslint:
+ name: ESLint (JS)
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 2 # to also fetch parent of PR (used to get changed files)
+
+ - name: Get changed files
+ id: js-changed
+ uses: ./.github/actions/changed_files/
+ with:
+ file-extensions: \.js$|\.js.erb$
+
+ - name: Setup Node.js
+ if: ${{ steps.js-changed.outputs.changed-files != ''}}
+ uses: actions/setup-node@v4
+ with:
+ node-version: '20' # End of Life (EOL): April 2026
+ cache: 'yarn'
+
+ - name: Install dependencies
+ if: ${{ steps.js-changed.outputs.changed-files != ''}}
+ run: yarn install
+
+ - name: Run ESLint
+ if: ${{ steps.js-changed.outputs.changed-files != ''}}
+ run: |
+ echo "🚨 Running ESLint version: $(yarn run --silent eslint --version)"
+ yarn run eslint --ignore-path .gitignore --max-warnings 0 ${{ steps.js-changed.outputs.changed-files }}
diff --git a/package.json b/package.json
index b867f8f8c..37d734e0d 100644
--- a/package.json
+++ b/package.json
@@ -19,5 +19,10 @@
},
"scripts": {
"lint": "eslint ."
+ },
+ "devDependencies": {
+ "@stylistic/eslint-plugin": "^1.5.0",
+ "eslint": "^8.55.0",
+ "eslint-plugin-erb": "^1.1.0"
}
-}
\ No newline at end of file
+}
diff --git a/yarn.lock b/yarn.lock
index e58b3b41b..9ef709e2c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,6 +2,11 @@
# yarn lockfile v1
+"@aashutoshrathi/word-wrap@^1.2.3":
+ version "1.2.6"
+ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf"
+ integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==
+
"@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630"
@@ -1001,11 +1006,62 @@
resolved "https://registry.yarnpkg.com/@discoveryjs/json-ext/-/json-ext-0.5.7.tgz#1d572bfbbe14b7704e0ba0f39b74815b84870d70"
integrity sha512-dBVuXR082gk3jsFp7Rd/JI4kytwGHecnCoTtXFb7DB6CNHp4rg5k1bhg0nWdLGLnOV71lmDzGQaLMy8iPLY0pw==
+"@eslint-community/eslint-utils@^4.2.0", "@eslint-community/eslint-utils@^4.4.0":
+ version "4.4.0"
+ resolved "https://registry.yarnpkg.com/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz#a23514e8fb9af1269d5f7788aa556798d61c6b59"
+ integrity sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==
+ dependencies:
+ eslint-visitor-keys "^3.3.0"
+
+"@eslint-community/regexpp@^4.6.1":
+ version "4.10.0"
+ resolved "https://registry.yarnpkg.com/@eslint-community/regexpp/-/regexpp-4.10.0.tgz#548f6de556857c8bb73bbee70c35dc82a2e74d63"
+ integrity sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==
+
+"@eslint/eslintrc@^2.1.4":
+ version "2.1.4"
+ resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-2.1.4.tgz#388a269f0f25c1b6adc317b5a2c55714894c70ad"
+ integrity sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==
+ dependencies:
+ ajv "^6.12.4"
+ debug "^4.3.2"
+ espree "^9.6.0"
+ globals "^13.19.0"
+ ignore "^5.2.0"
+ import-fresh "^3.2.1"
+ js-yaml "^4.1.0"
+ minimatch "^3.1.2"
+ strip-json-comments "^3.1.1"
+
+"@eslint/js@8.55.0":
+ version "8.55.0"
+ resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.55.0.tgz#b721d52060f369aa259cf97392403cb9ce892ec6"
+ integrity sha512-qQfo2mxH5yVom1kacMtZZJFVdW+E70mqHMJvVg6WTLo+VBuQJ4TojZlfWBjK0ve5BdEeNAVxOsl/nvNMpJOaJA==
+
"@gar/promisify@^1.0.1":
version "1.1.3"
resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.3.tgz#555193ab2e3bb3b6adc3d551c9c030d9e860daf6"
integrity sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==
+"@humanwhocodes/config-array@^0.11.13":
+ version "0.11.13"
+ resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.11.13.tgz#075dc9684f40a531d9b26b0822153c1e832ee297"
+ integrity sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==
+ dependencies:
+ "@humanwhocodes/object-schema" "^2.0.1"
+ debug "^4.1.1"
+ minimatch "^3.0.5"
+
+"@humanwhocodes/module-importer@^1.0.1":
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz#af5b2691a22b44be847b0ca81641c5fb6ad0172c"
+ integrity sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==
+
+"@humanwhocodes/object-schema@^2.0.1":
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz#e5211452df060fa8522b55c7b3c0c4d1981cb044"
+ integrity sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==
+
"@jridgewell/gen-mapping@^0.3.0", "@jridgewell/gen-mapping@^0.3.2":
version "0.3.3"
resolved "https://registry.yarnpkg.com/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz#7e02e6eb5df901aaedb08514203b096614024098"
@@ -1056,6 +1112,27 @@
resolved "https://registry.yarnpkg.com/@leichtgewicht/ip-codec/-/ip-codec-2.0.4.tgz#b2ac626d6cb9c8718ab459166d4bb405b8ffa78b"
integrity sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==
+"@nodelib/fs.scandir@2.1.5":
+ version "2.1.5"
+ resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5"
+ integrity sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==
+ dependencies:
+ "@nodelib/fs.stat" "2.0.5"
+ run-parallel "^1.1.9"
+
+"@nodelib/fs.stat@2.0.5", "@nodelib/fs.stat@^2.0.2":
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz#5bd262af94e9d25bd1e71b05deed44876a222e8b"
+ integrity sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==
+
+"@nodelib/fs.walk@^1.2.3", "@nodelib/fs.walk@^1.2.8":
+ version "1.2.8"
+ resolved "https://registry.yarnpkg.com/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz#e95737e8bb6746ddedf69c556953494f196fe69a"
+ integrity sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==
+ dependencies:
+ "@nodelib/fs.scandir" "2.1.5"
+ fastq "^1.6.0"
+
"@npmcli/fs@^1.0.0":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@npmcli/fs/-/fs-1.1.1.tgz#72f719fe935e687c56a4faecf3c03d06ba593257"
@@ -1116,6 +1193,51 @@
webpack-cli "^3.3.12"
webpack-sources "^1.4.3"
+"@stylistic/eslint-plugin-js@1.5.0", "@stylistic/eslint-plugin-js@^1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-js/-/eslint-plugin-js-1.5.0.tgz#d502d2470f114a4a2b682930ade6ca4eeebaa9f8"
+ integrity sha512-TuGQv1bsIshkbJUInCewp4IUWy24W5RFiVNMV0quPSkuZ8gsYoqq6kLHvvaxpjxN9TvwSoOIwnhgrYKei2Tgcw==
+ dependencies:
+ acorn "^8.11.2"
+ escape-string-regexp "^4.0.0"
+ eslint-visitor-keys "^3.4.3"
+ espree "^9.6.1"
+ graphemer "^1.4.0"
+
+"@stylistic/eslint-plugin-jsx@1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-jsx/-/eslint-plugin-jsx-1.5.0.tgz#f8fcb23dcc75b455650426887b24711c4831bee6"
+ integrity sha512-sqFdA1mS0jwovAatS8xFAiwxPbcy69S2AUjrGMxyhxaKbELPjvqbxPYJL+35ylT0xqirUlm118xZIFDooC8koQ==
+ dependencies:
+ "@stylistic/eslint-plugin-js" "^1.5.0"
+ estraverse "^5.3.0"
+
+"@stylistic/eslint-plugin-plus@1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-plus/-/eslint-plugin-plus-1.5.0.tgz#49ad5560bb6b699c1b5d2940586a4048ebc35b1c"
+ integrity sha512-+A4qXFuM6V7x25Hj+xqfVIUbEckG+MUSvL6m83M6YtRq3d5zLW+giKKEL7eSCAw12MwnoDwPcEhqIJK6BRDR3w==
+ dependencies:
+ "@typescript-eslint/utils" "^6.13.2"
+
+"@stylistic/eslint-plugin-ts@1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin-ts/-/eslint-plugin-ts-1.5.0.tgz#ed84ffe3c2809748337079b6309f2906ff268e02"
+ integrity sha512-OusNGWRXnOV+ywnoXmBFoMtU6Ig/MX1bEu5Jigqmy2cIT8GRMMn7jUl/bXevkv2o66MYnC7PT1Q/3GvN7t0/eg==
+ dependencies:
+ "@stylistic/eslint-plugin-js" "1.5.0"
+ "@typescript-eslint/utils" "^6.13.2"
+ graphemer "^1.4.0"
+
+"@stylistic/eslint-plugin@^1.5.0":
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/@stylistic/eslint-plugin/-/eslint-plugin-1.5.0.tgz#d89c813c9f2121a33e1e6d3d3c521ff015964e61"
+ integrity sha512-XmlB5nxk06nlnx1/ka0l+WNqHcjnnXfDts4ZaCvrpCY/6l8lNtHwLwdCKF/UpBYNuRWI/HLWCTtQc0jjfwrfBA==
+ dependencies:
+ "@stylistic/eslint-plugin-js" "1.5.0"
+ "@stylistic/eslint-plugin-jsx" "1.5.0"
+ "@stylistic/eslint-plugin-plus" "1.5.0"
+ "@stylistic/eslint-plugin-ts" "1.5.0"
+
"@types/body-parser@*":
version "1.19.2"
resolved "https://registry.yarnpkg.com/@types/body-parser/-/body-parser-1.19.2.tgz#aea2059e28b7658639081347ac4fab3de166e6f0"
@@ -1178,6 +1300,11 @@
dependencies:
"@types/node" "*"
+"@types/json-schema@^7.0.12":
+ version "7.0.15"
+ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
+ integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
+
"@types/json-schema@^7.0.5", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9":
version "7.0.12"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.12.tgz#d70faba7039d5fca54c83c7dbab41051d2b6f6cb"
@@ -1223,6 +1350,11 @@
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.0.tgz#2b35eccfcee7d38cd72ad99232fbd58bffb3c84d"
integrity sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==
+"@types/semver@^7.5.0":
+ version "7.5.6"
+ resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.5.6.tgz#c65b2bfce1bec346582c07724e3f8c1017a20339"
+ integrity sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==
+
"@types/send@*":
version "0.17.1"
resolved "https://registry.yarnpkg.com/@types/send/-/send-0.17.1.tgz#ed4932b8a2a805f1fe362a70f4e62d0ac994e301"
@@ -1261,6 +1393,58 @@
dependencies:
"@types/node" "*"
+"@typescript-eslint/scope-manager@6.13.2":
+ version "6.13.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-6.13.2.tgz#5fa4e4adace028dafac212c770640b94e7b61052"
+ integrity sha512-CXQA0xo7z6x13FeDYCgBkjWzNqzBn8RXaE3QVQVIUm74fWJLkJkaHmHdKStrxQllGh6Q4eUGyNpMe0b1hMkXFA==
+ dependencies:
+ "@typescript-eslint/types" "6.13.2"
+ "@typescript-eslint/visitor-keys" "6.13.2"
+
+"@typescript-eslint/types@6.13.2":
+ version "6.13.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-6.13.2.tgz#c044aac24c2f6cefb8e921e397acad5417dd0ae6"
+ integrity sha512-7sxbQ+EMRubQc3wTfTsycgYpSujyVbI1xw+3UMRUcrhSy+pN09y/lWzeKDbvhoqcRbHdc+APLs/PWYi/cisLPg==
+
+"@typescript-eslint/typescript-estree@6.13.2":
+ version "6.13.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.2.tgz#ae556ee154c1acf025b48d37c3ef95a1d55da258"
+ integrity sha512-SuD8YLQv6WHnOEtKv8D6HZUzOub855cfPnPMKvdM/Bh1plv1f7Q/0iFUDLKKlxHcEstQnaUU4QZskgQq74t+3w==
+ dependencies:
+ "@typescript-eslint/types" "6.13.2"
+ "@typescript-eslint/visitor-keys" "6.13.2"
+ debug "^4.3.4"
+ globby "^11.1.0"
+ is-glob "^4.0.3"
+ semver "^7.5.4"
+ ts-api-utils "^1.0.1"
+
+"@typescript-eslint/utils@^6.13.2":
+ version "6.13.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/utils/-/utils-6.13.2.tgz#8eb89e53adc6d703a879b131e528807245486f89"
+ integrity sha512-b9Ptq4eAZUym4idijCRzl61oPCwwREcfDI8xGk751Vhzig5fFZR9CyzDz4Sp/nxSLBYxUPyh4QdIDqWykFhNmQ==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.4.0"
+ "@types/json-schema" "^7.0.12"
+ "@types/semver" "^7.5.0"
+ "@typescript-eslint/scope-manager" "6.13.2"
+ "@typescript-eslint/types" "6.13.2"
+ "@typescript-eslint/typescript-estree" "6.13.2"
+ semver "^7.5.4"
+
+"@typescript-eslint/visitor-keys@6.13.2":
+ version "6.13.2"
+ resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.2.tgz#e0a4a80cf842bb08e6127b903284166ac4a5594c"
+ integrity sha512-OGznFs0eAQXJsp+xSd6k/O1UbFi/K/L7WjqeRoFE7vadjAF9y0uppXhYNQNEqygjou782maGClOoZwPqF0Drlw==
+ dependencies:
+ "@typescript-eslint/types" "6.13.2"
+ eslint-visitor-keys "^3.4.1"
+
+"@ungap/structured-clone@^1.2.0":
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406"
+ integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==
+
"@webassemblyjs/ast@1.9.0":
version "1.9.0"
resolved "https://registry.yarnpkg.com/@webassemblyjs/ast/-/ast-1.9.0.tgz#bd850604b4042459a5a41cd7d338cbed695ed964"
@@ -1441,11 +1625,21 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8:
mime-types "~2.1.34"
negotiator "0.6.3"
+acorn-jsx@^5.3.2:
+ version "5.3.2"
+ resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
+ integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==
+
acorn@^6.4.1:
version "6.4.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.2.tgz#35866fd710528e92de10cf06016498e47e39e1e6"
integrity sha512-XtGIhXwF8YM8bJhGxG5kXgjkEuNGLTkoYqVE+KMR+aspr4KGYmKYg7yUe3KghyQ9yheNwLnjmzh/7+gfDBmHCQ==
+acorn@^8.11.2, acorn@^8.9.0:
+ version "8.11.2"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b"
+ integrity sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==
+
acorn@^8.8.2:
version "8.9.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.9.0.tgz#78a16e3b2bcc198c10822786fa6679e245db5b59"
@@ -1518,6 +1712,11 @@ ansi-regex@^4.1.0:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.1.tgz#164daac87ab2d6f6db3a29875e2d1766582dabed"
integrity sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==
+ansi-regex@^5.0.1:
+ version "5.0.1"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
+ integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
+
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
@@ -1525,6 +1724,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1:
dependencies:
color-convert "^1.9.0"
+ansi-styles@^4.1.0:
+ version "4.3.0"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
+ integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
+ dependencies:
+ color-convert "^2.0.1"
+
anymatch@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
@@ -1553,6 +1759,11 @@ argparse@^1.0.7:
dependencies:
sprintf-js "~1.0.2"
+argparse@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/argparse/-/argparse-2.0.1.tgz#246f50f3ca78a3240f6c997e8a9bd1eac49e4b38"
+ integrity sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==
+
arr-diff@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@@ -1586,6 +1797,11 @@ array-flatten@^2.1.2:
resolved "https://registry.yarnpkg.com/array-flatten/-/array-flatten-2.1.2.tgz#24ef80a28c1a893617e2149b0c6d0d788293b099"
integrity sha512-hNfzcOV8W4NdualtqBFPyVO+54DSJuZGY9qT4pRroB6S9e3iiido2ISIC5h9R2sPJ8H3FHCIiEnsv1lPXO3KtQ==
+array-union@^2.1.0:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
+ integrity sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==
+
array-unique@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428"
@@ -2068,6 +2284,14 @@ chalk@^2.0, chalk@^2.0.0, chalk@^2.4.1, chalk@^2.4.2:
escape-string-regexp "^1.0.5"
supports-color "^5.3.0"
+chalk@^4.0.0:
+ version "4.1.2"
+ resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01"
+ integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==
+ dependencies:
+ ansi-styles "^4.1.0"
+ supports-color "^7.1.0"
+
"chokidar@>=3.0.0 <4.0.0", chokidar@^3.4.1, chokidar@^3.5.3:
version "3.5.3"
resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd"
@@ -2195,12 +2419,19 @@ color-convert@^1.9.0, color-convert@^1.9.3:
dependencies:
color-name "1.1.3"
+color-convert@^2.0.1:
+ version "2.0.1"
+ resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
+ integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==
+ dependencies:
+ color-name "~1.1.4"
+
color-name@1.1.3:
version "1.1.3"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==
-color-name@^1.0.0:
+color-name@^1.0.0, color-name@~1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
@@ -2436,7 +2667,7 @@ cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"
-cross-spawn@^7.0.3:
+cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -2670,7 +2901,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3:
dependencies:
ms "2.0.0"
-debug@^4.1.0, debug@^4.1.1:
+debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
@@ -2687,6 +2918,11 @@ decode-uri-component@^0.2.0:
resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9"
integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==
+deep-is@^0.1.3:
+ version "0.1.4"
+ resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.4.tgz#a6f2dce612fadd2ef1f519b73551f17e85199831"
+ integrity sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==
+
default-gateway@^6.0.3:
version "6.0.3"
resolved "https://registry.yarnpkg.com/default-gateway/-/default-gateway-6.0.3.tgz#819494c888053bdb743edbf343d6cdf7f2943a71"
@@ -2771,6 +3007,13 @@ diffie-hellman@^5.0.0:
miller-rabin "^4.0.0"
randombytes "^2.0.0"
+dir-glob@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/dir-glob/-/dir-glob-3.0.1.tgz#56dbf73d992a4a93ba1584f4534063fd2e41717f"
+ integrity sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==
+ dependencies:
+ path-type "^4.0.0"
+
dns-equal@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d"
@@ -2783,6 +3026,13 @@ dns-packet@^5.2.2:
dependencies:
"@leichtgewicht/ip-codec" "^2.0.1"
+doctrine@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/doctrine/-/doctrine-3.0.0.tgz#addebead72a6574db783639dc87a121773973961"
+ integrity sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==
+ dependencies:
+ esutils "^2.0.2"
+
dom-serializer@0:
version "0.2.2"
resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-0.2.2.tgz#1afb81f533717175d478655debc5e332d9f9bb51"
@@ -2987,6 +3237,16 @@ escape-string-regexp@^1.0.5:
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
integrity sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==
+escape-string-regexp@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34"
+ integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==
+
+eslint-plugin-erb@^1.1.0:
+ version "1.1.0"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-erb/-/eslint-plugin-erb-1.1.0.tgz#ac0ac8d5b5e75602c0e41016ff525748cc66d95e"
+ integrity sha512-uKd0Trv+g2B6xvv471NvGfph17dBYbv4zKruCkbI/EmZVGJaZw7ohhfV/60ld7Rdl74pUG5CV2OLo7TQPDLDPg==
+
eslint-scope@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848"
@@ -2995,12 +3255,85 @@ eslint-scope@^4.0.3:
esrecurse "^4.1.0"
estraverse "^4.1.1"
+eslint-scope@^7.2.2:
+ version "7.2.2"
+ resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.2.tgz#deb4f92563390f32006894af62a22dba1c46423f"
+ integrity sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==
+ dependencies:
+ esrecurse "^4.3.0"
+ estraverse "^5.2.0"
+
+eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4.1, eslint-visitor-keys@^3.4.3:
+ version "3.4.3"
+ resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz#0cd72fe8550e3c2eae156a96a4dddcd1c8ac5800"
+ integrity sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==
+
+eslint@^8.55.0:
+ version "8.55.0"
+ resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.55.0.tgz#078cb7b847d66f2c254ea1794fa395bf8e7e03f8"
+ integrity sha512-iyUUAM0PCKj5QpwGfmCAG9XXbZCWsqP/eWAWrG/W0umvjuLRBECwSFdt+rCntju0xEH7teIABPwXpahftIaTdA==
+ dependencies:
+ "@eslint-community/eslint-utils" "^4.2.0"
+ "@eslint-community/regexpp" "^4.6.1"
+ "@eslint/eslintrc" "^2.1.4"
+ "@eslint/js" "8.55.0"
+ "@humanwhocodes/config-array" "^0.11.13"
+ "@humanwhocodes/module-importer" "^1.0.1"
+ "@nodelib/fs.walk" "^1.2.8"
+ "@ungap/structured-clone" "^1.2.0"
+ ajv "^6.12.4"
+ chalk "^4.0.0"
+ cross-spawn "^7.0.2"
+ debug "^4.3.2"
+ doctrine "^3.0.0"
+ escape-string-regexp "^4.0.0"
+ eslint-scope "^7.2.2"
+ eslint-visitor-keys "^3.4.3"
+ espree "^9.6.1"
+ esquery "^1.4.2"
+ esutils "^2.0.2"
+ fast-deep-equal "^3.1.3"
+ file-entry-cache "^6.0.1"
+ find-up "^5.0.0"
+ glob-parent "^6.0.2"
+ globals "^13.19.0"
+ graphemer "^1.4.0"
+ ignore "^5.2.0"
+ imurmurhash "^0.1.4"
+ is-glob "^4.0.0"
+ is-path-inside "^3.0.3"
+ js-yaml "^4.1.0"
+ json-stable-stringify-without-jsonify "^1.0.1"
+ levn "^0.4.1"
+ lodash.merge "^4.6.2"
+ minimatch "^3.1.2"
+ natural-compare "^1.4.0"
+ optionator "^0.9.3"
+ strip-ansi "^6.0.1"
+ text-table "^0.2.0"
+
+espree@^9.6.0, espree@^9.6.1:
+ version "9.6.1"
+ resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.1.tgz#a2a17b8e434690a5432f2f8018ce71d331a48c6f"
+ integrity sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==
+ dependencies:
+ acorn "^8.9.0"
+ acorn-jsx "^5.3.2"
+ eslint-visitor-keys "^3.4.1"
+
esprima@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71"
integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==
-esrecurse@^4.1.0:
+esquery@^1.4.2:
+ version "1.5.0"
+ resolved "https://registry.yarnpkg.com/esquery/-/esquery-1.5.0.tgz#6ce17738de8577694edd7361c57182ac8cb0db0b"
+ integrity sha512-YQLXUplAwJgCydQ78IMJywZCceoqk1oH01OERdSAJc/7U2AylwjhSCLDEtqwg811idIS/9fIU5GjG73IgjKMVg==
+ dependencies:
+ estraverse "^5.1.0"
+
+esrecurse@^4.1.0, esrecurse@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/esrecurse/-/esrecurse-4.3.0.tgz#7ad7964d679abb28bee72cec63758b1c5d2c9921"
integrity sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==
@@ -3012,7 +3345,7 @@ estraverse@^4.1.1:
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-4.3.0.tgz#398ad3f3c5a24948be7725e83d11a7de28cdbd1d"
integrity sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==
-estraverse@^5.2.0:
+estraverse@^5.1.0, estraverse@^5.2.0, estraverse@^5.3.0:
version "5.3.0"
resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123"
integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==
@@ -3151,16 +3484,39 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
+fast-glob@^3.2.9:
+ version "3.3.2"
+ resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.3.2.tgz#a904501e57cfdd2ffcded45e99a54fef55e46129"
+ integrity sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==
+ dependencies:
+ "@nodelib/fs.stat" "^2.0.2"
+ "@nodelib/fs.walk" "^1.2.3"
+ glob-parent "^5.1.2"
+ merge2 "^1.3.0"
+ micromatch "^4.0.4"
+
fast-json-stable-stringify@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633"
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==
+fast-levenshtein@^2.0.6:
+ version "2.0.6"
+ resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917"
+ integrity sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==
+
fastest-levenshtein@^1.0.12:
version "1.0.16"
resolved "https://registry.yarnpkg.com/fastest-levenshtein/-/fastest-levenshtein-1.0.16.tgz#210e61b6ff181de91ea9b3d1b84fdedd47e034e5"
integrity sha512-eRnCtTTtGZFpQCwhJiUOuxPQWRXVKYDn0b2PeHfXL6/Zi53SLAzAHfVhVWK2AryC/WH05kGfxhFIPvTF0SXQzg==
+fastq@^1.6.0:
+ version "1.15.0"
+ resolved "https://registry.yarnpkg.com/fastq/-/fastq-1.15.0.tgz#d04d07c6a2a68fe4599fea8d2e103a937fae6b3a"
+ integrity sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==
+ dependencies:
+ reusify "^1.0.4"
+
faye-websocket@^0.11.3:
version "0.11.4"
resolved "https://registry.yarnpkg.com/faye-websocket/-/faye-websocket-0.11.4.tgz#7f0d9275cfdd86a1c963dc8b65fcc451edcbb1da"
@@ -3173,6 +3529,13 @@ figgy-pudding@^3.5.1:
resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.2.tgz#b4eee8148abb01dcf1d1ac34367d59e12fa61d6e"
integrity sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==
+file-entry-cache@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027"
+ integrity sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==
+ dependencies:
+ flat-cache "^3.0.4"
+
file-loader@^6.2.0:
version "6.2.0"
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
@@ -3249,6 +3612,14 @@ find-up@^4.0.0:
locate-path "^5.0.0"
path-exists "^4.0.0"
+find-up@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
+ integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
+ dependencies:
+ locate-path "^6.0.0"
+ path-exists "^4.0.0"
+
findup-sync@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-3.0.0.tgz#17b108f9ee512dfb7a5c7f3c8b27ea9e1a9c08d1"
@@ -3259,11 +3630,25 @@ findup-sync@^3.0.0:
micromatch "^3.0.4"
resolve-dir "^1.0.1"
+flat-cache@^3.0.4:
+ version "3.2.0"
+ resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-3.2.0.tgz#2c0c2d5040c99b1632771a9d105725c0115363ee"
+ integrity sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==
+ dependencies:
+ flatted "^3.2.9"
+ keyv "^4.5.3"
+ rimraf "^3.0.2"
+
flatted@^3.2.2:
version "3.2.7"
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.7.tgz#609f39207cb614b89d0765b477cb2d437fbf9787"
integrity sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==
+flatted@^3.2.9:
+ version "3.2.9"
+ resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
+ integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==
+
flatten@^1.0.2:
version "1.0.3"
resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.3.tgz#c1283ac9f27b368abc1e36d1ff7b04501a30356b"
@@ -3443,13 +3828,20 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"
-glob-parent@~5.1.2:
+glob-parent@^5.1.2, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
dependencies:
is-glob "^4.0.1"
+glob-parent@^6.0.2:
+ version "6.0.2"
+ resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-6.0.2.tgz#6d237d99083950c79290f24c7642a3de9a28f9e3"
+ integrity sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==
+ dependencies:
+ is-glob "^4.0.3"
+
glob@^7.1.3, glob@^7.1.4, glob@^7.1.7:
version "7.2.3"
resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b"
@@ -3503,6 +3895,13 @@ globals@^11.1.0:
resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e"
integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==
+globals@^13.19.0:
+ version "13.23.0"
+ resolved "https://registry.yarnpkg.com/globals/-/globals-13.23.0.tgz#ef31673c926a0976e1f61dab4dca57e0c0a8af02"
+ integrity sha512-XAmF0RjlrjY23MA51q3HltdlGxUpXPvg0GioKiD9X6HD28iMjo2dKC8Vqwm7lne4GNr78+RHTfliktR6ZH09wA==
+ dependencies:
+ type-fest "^0.20.2"
+
globalthis@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/globalthis/-/globalthis-1.0.3.tgz#5852882a52b80dc301b0660273e1ed082f0b6ccf"
@@ -3510,6 +3909,18 @@ globalthis@^1.0.3:
dependencies:
define-properties "^1.1.3"
+globby@^11.1.0:
+ version "11.1.0"
+ resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
+ integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
+ dependencies:
+ array-union "^2.1.0"
+ dir-glob "^3.0.1"
+ fast-glob "^3.2.9"
+ ignore "^5.2.0"
+ merge2 "^1.4.1"
+ slash "^3.0.0"
+
gopd@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/gopd/-/gopd-1.0.1.tgz#29ff76de69dac7489b7c0918a5788e56477c332c"
@@ -3522,6 +3933,11 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.2.6
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.11.tgz#4183e4e8bf08bb6e05bbb2f7d2e0c8f712ca40e3"
integrity sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==
+graphemer@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/graphemer/-/graphemer-1.4.0.tgz#fb2f1d55e0e3a1849aeffc90c4fa0dd53a0e66c6"
+ integrity sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==
+
handle-thing@^2.0.0:
version "2.0.1"
resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e"
@@ -3757,6 +4173,11 @@ iferr@^0.1.5:
resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501"
integrity sha512-DUNFN5j7Tln0D+TxzloUjKB+CtVu6myn0JEFak6dG18mNt9YkQ6lzGCdafwofISZ1lLF3xRHJ98VKy9ynkcFaA==
+ignore@^5.2.0:
+ version "5.3.0"
+ resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.3.0.tgz#67418ae40d34d6999c95ff56016759c718c82f78"
+ integrity sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==
+
immutable@^4.0.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.0.tgz#eb1738f14ffb39fd068b1dbe1296117484dd34be"
@@ -3777,7 +4198,7 @@ import-fresh@^2.0.0:
caller-path "^2.0.0"
resolve-from "^3.0.0"
-import-fresh@^3.1.0:
+import-fresh@^3.1.0, import-fresh@^3.2.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/import-fresh/-/import-fresh-3.3.0.tgz#37162c25fcb9ebaa2e6e53d5b4d88ce17d9e0c2b"
integrity sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==
@@ -4069,7 +4490,7 @@ is-glob@^3.1.0:
dependencies:
is-extglob "^2.1.0"
-is-glob@^4.0.0, is-glob@^4.0.1, is-glob@~4.0.1:
+is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1:
version "4.0.3"
resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084"
integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==
@@ -4105,6 +4526,11 @@ is-obj@^2.0.0:
resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
+is-path-inside@^3.0.3:
+ version "3.0.3"
+ resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
+ integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
+
is-plain-obj@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-1.1.0.tgz#71a50c8429dfca773c92a390a4a03b39fcd51d3e"
@@ -4245,6 +4671,13 @@ js-yaml@^3.13.1, js-yaml@^3.14.1:
argparse "^1.0.7"
esprima "^4.0.0"
+js-yaml@^4.1.0:
+ version "4.1.0"
+ resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-4.1.0.tgz#c1fb65f8f5017901cdd2c951864ba18458a10602"
+ integrity sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==
+ dependencies:
+ argparse "^2.0.1"
+
jsesc@^2.5.1:
version "2.5.2"
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-2.5.2.tgz#80564d2e483dacf6e8ef209650a67df3f0c283a4"
@@ -4255,6 +4688,11 @@ jsesc@~0.5.0:
resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d"
integrity sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==
+json-buffer@3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/json-buffer/-/json-buffer-3.0.1.tgz#9338802a30d3b6605fbe0613e094008ca8c05a13"
+ integrity sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==
+
json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
@@ -4275,6 +4713,11 @@ json-schema-traverse@^1.0.0:
resolved "https://registry.yarnpkg.com/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz#ae7bcb3656ab77a73ba5c49bf654f38e6b6860e2"
integrity sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==
+json-stable-stringify-without-jsonify@^1.0.1:
+ version "1.0.1"
+ resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651"
+ integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==
+
json5@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593"
@@ -4287,6 +4730,13 @@ json5@^2.1.2, json5@^2.2.2:
resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283"
integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==
+keyv@^4.5.3:
+ version "4.5.4"
+ resolved "https://registry.yarnpkg.com/keyv/-/keyv-4.5.4.tgz#a879a99e29452f942439f2a405e3af8b31d4de93"
+ integrity sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==
+ dependencies:
+ json-buffer "3.0.1"
+
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
@@ -4332,6 +4782,14 @@ launch-editor@^2.6.0:
picocolors "^1.0.0"
shell-quote "^1.7.3"
+levn@^0.4.1:
+ version "0.4.1"
+ resolved "https://registry.yarnpkg.com/levn/-/levn-0.4.1.tgz#ae4562c007473b932a6200d403268dd2fffc6ade"
+ integrity sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==
+ dependencies:
+ prelude-ls "^1.2.1"
+ type-check "~0.4.0"
+
lines-and-columns@^1.1.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
@@ -4375,6 +4833,13 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
+locate-path@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
+ integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
+ dependencies:
+ p-locate "^5.0.0"
+
lodash.debounce@^4.0.8:
version "4.0.8"
resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
@@ -4395,6 +4860,11 @@ lodash.memoize@^4.1.2:
resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe"
integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==
+lodash.merge@^4.6.2:
+ version "4.6.2"
+ resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
+ integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==
+
lodash.uniq@^4.5.0:
version "4.5.0"
resolved "https://registry.yarnpkg.com/lodash.uniq/-/lodash.uniq-4.5.0.tgz#d0225373aeb652adc1bc82e4945339a842754773"
@@ -4503,6 +4973,11 @@ merge-stream@^2.0.0:
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==
+merge2@^1.3.0, merge2@^1.4.1:
+ version "1.4.1"
+ resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
+ integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==
+
methods@~1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/methods/-/methods-1.1.2.tgz#5529a4d67654134edcc5266656835b0f851afcee"
@@ -4527,7 +5002,7 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4:
snapdragon "^0.8.1"
to-regex "^3.0.2"
-micromatch@^4.0.2:
+micromatch@^4.0.2, micromatch@^4.0.4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
@@ -4585,7 +5060,7 @@ minimalistic-crypto-utils@^1.0.1:
resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a"
integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==
-minimatch@^3.1.1:
+minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
@@ -4736,6 +5211,11 @@ nanomatch@^1.2.9:
snapdragon "^0.8.1"
to-regex "^3.0.1"
+natural-compare@^1.4.0:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
+ integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==
+
negotiator@0.6.3:
version "0.6.3"
resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd"
@@ -4962,6 +5442,18 @@ optimize-css-assets-webpack-plugin@^5.0.8:
cssnano "^4.1.10"
last-call-webpack-plugin "^3.0.0"
+optionator@^0.9.3:
+ version "0.9.3"
+ resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.9.3.tgz#007397d44ed1872fdc6ed31360190f81814e2c64"
+ integrity sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==
+ dependencies:
+ "@aashutoshrathi/word-wrap" "^1.2.3"
+ deep-is "^0.1.3"
+ fast-levenshtein "^2.0.6"
+ levn "^0.4.1"
+ prelude-ls "^1.2.1"
+ type-check "^0.4.0"
+
os-browserify@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/os-browserify/-/os-browserify-0.3.0.tgz#854373c7f5c2315914fc9bfc6bd8238fdda1ec27"
@@ -4995,6 +5487,13 @@ p-locate@^4.1.0:
dependencies:
p-limit "^2.2.0"
+p-locate@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
+ integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
+ dependencies:
+ p-limit "^3.0.2"
+
p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
@@ -5874,6 +6373,11 @@ postcss@^8.2.15:
picocolors "^1.0.0"
source-map-js "^1.0.2"
+prelude-ls@^1.2.1:
+ version "1.2.1"
+ resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
+ integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
+
prepend-http@^1.0.0:
version "1.0.4"
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
@@ -5991,6 +6495,11 @@ querystring-es3@^0.2.0:
resolved "https://registry.yarnpkg.com/querystring-es3/-/querystring-es3-0.2.1.tgz#9ec61f79049875707d69414596fd907a4d711e73"
integrity sha512-773xhDQnZBMFobEiztv8LIl70ch5MSF/jUQVlhwFyBILqq96anmoctVIYz+ZRp0qbCKATTn6ev02M3r7Ga5vqA==
+queue-microtask@^1.2.2:
+ version "1.2.3"
+ resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
+ integrity sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==
+
randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a"
@@ -6229,6 +6738,11 @@ retry@^0.13.1:
resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658"
integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==
+reusify@^1.0.4:
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
+ integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
+
rgb-regex@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1"
@@ -6261,6 +6775,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
hash-base "^3.0.0"
inherits "^2.0.1"
+run-parallel@^1.1.9:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee"
+ integrity sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==
+ dependencies:
+ queue-microtask "^1.2.2"
+
run-queue@^1.0.0, run-queue@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47"
@@ -6411,6 +6932,13 @@ semver@^7.3.2, semver@^7.3.5:
dependencies:
lru-cache "^6.0.0"
+semver@^7.5.4:
+ version "7.5.4"
+ resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
+ integrity sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==
+ dependencies:
+ lru-cache "^6.0.0"
+
send@0.18.0:
version "0.18.0"
resolved "https://registry.yarnpkg.com/send/-/send-0.18.0.tgz#670167cc654b05f5aa4a767f9113bb371bc706be"
@@ -6562,6 +7090,11 @@ simple-swizzle@^0.2.2:
dependencies:
is-arrayish "^0.3.1"
+slash@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
+ integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==
+
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
@@ -6818,6 +7351,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0:
dependencies:
ansi-regex "^4.1.0"
+strip-ansi@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
+ integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
+ dependencies:
+ ansi-regex "^5.0.1"
+
strip-comments@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/strip-comments/-/strip-comments-2.0.1.tgz#4ad11c3fbcac177a67a40ac224ca339ca1c1ba9b"
@@ -6828,6 +7368,11 @@ strip-final-newline@^2.0.0:
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
+strip-json-comments@^3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
+ integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==
+
style-loader@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.3.0.tgz#828b4a3b3b7e7aa5847ce7bae9e874512114249e"
@@ -6859,7 +7404,7 @@ supports-color@^6.1.0:
dependencies:
has-flag "^3.0.0"
-supports-color@^7.0.0:
+supports-color@^7.0.0, supports-color@^7.1.0:
version "7.2.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da"
integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==
@@ -6956,6 +7501,11 @@ terser@^5.3.4:
commander "^2.20.0"
source-map-support "~0.5.20"
+text-table@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
+ integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==
+
through2@^2.0.0:
version "2.0.5"
resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.5.tgz#01c1e39eb31d07cb7d03a96a70823260b23132cd"
@@ -7028,6 +7578,11 @@ toidentifier@1.0.1:
resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35"
integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==
+ts-api-utils@^1.0.1:
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/ts-api-utils/-/ts-api-utils-1.0.3.tgz#f12c1c781d04427313dbac808f453f050e54a331"
+ integrity sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==
+
ts-pnp@^1.1.6:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
@@ -7038,6 +7593,18 @@ tty-browserify@0.0.0:
resolved "https://registry.yarnpkg.com/tty-browserify/-/tty-browserify-0.0.0.tgz#a157ba402da24e9bf957f9aa69d524eed42901a6"
integrity sha512-JVa5ijo+j/sOoHGjw0sxw734b1LhBkQ3bvUGNdxnVXDCX81Yx7TFgnZygxrIIWn23hbfTaMYLwRmAxFyDuFmIw==
+type-check@^0.4.0, type-check@~0.4.0:
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"
+ integrity sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==
+ dependencies:
+ prelude-ls "^1.2.1"
+
+type-fest@^0.20.2:
+ version "0.20.2"
+ resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4"
+ integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==
+
type-is@~1.6.18:
version "1.6.18"
resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131"