Fix Rubocop offenses

This commit is contained in:
Sebastian Serth
2023-12-25 14:01:09 +01:00
parent e81eaee2ba
commit 34c322f8c0
3 changed files with 4 additions and 4 deletions

View File

@ -64,7 +64,7 @@ module CodeOcean
validates_with FileNameValidator, fields: %i[name path file_type_id]
ROLES.each do |role|
define_method("#{role}?") { self.role == role }
define_method(:"#{role}?") { self.role == role }
end
def read

View File

@ -29,8 +29,8 @@ class FileType < ApplicationRecord
validates :file_extension, length: {minimum: 0, allow_nil: false}
%i[audio compressed csv excel image pdf powerpoint video word].each do |type|
define_method("#{type}?") do
self.class.const_get("#{type.upcase}_FILE_EXTENSIONS").include?(file_extension)
define_method(:"#{type}?") do
self.class.const_get(:"#{type.upcase}_FILE_EXTENSIONS").include?(file_extension)
end
end

View File

@ -17,7 +17,7 @@ end
module ActiveRecord
class Base
%i[build create].each do |strategy|
define_singleton_method("#{strategy}_factories") do |attributes = {}|
define_singleton_method(:"#{strategy}_factories") do |attributes = {}|
find_factories_by_class(self).map(&:name).map do |factory_name|
FactoryBot.send(strategy, factory_name, attributes)
end