Fix Rubocop offenses
This commit is contained in:
@ -64,7 +64,7 @@ module CodeOcean
|
|||||||
validates_with FileNameValidator, fields: %i[name path file_type_id]
|
validates_with FileNameValidator, fields: %i[name path file_type_id]
|
||||||
|
|
||||||
ROLES.each do |role|
|
ROLES.each do |role|
|
||||||
define_method("#{role}?") { self.role == role }
|
define_method(:"#{role}?") { self.role == role }
|
||||||
end
|
end
|
||||||
|
|
||||||
def read
|
def read
|
||||||
|
@ -29,8 +29,8 @@ class FileType < ApplicationRecord
|
|||||||
validates :file_extension, length: {minimum: 0, allow_nil: false}
|
validates :file_extension, length: {minimum: 0, allow_nil: false}
|
||||||
|
|
||||||
%i[audio compressed csv excel image pdf powerpoint video word].each do |type|
|
%i[audio compressed csv excel image pdf powerpoint video word].each do |type|
|
||||||
define_method("#{type}?") do
|
define_method(:"#{type}?") do
|
||||||
self.class.const_get("#{type.upcase}_FILE_EXTENSIONS").include?(file_extension)
|
self.class.const_get(:"#{type.upcase}_FILE_EXTENSIONS").include?(file_extension)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ end
|
|||||||
module ActiveRecord
|
module ActiveRecord
|
||||||
class Base
|
class Base
|
||||||
%i[build create].each do |strategy|
|
%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|
|
find_factories_by_class(self).map(&:name).map do |factory_name|
|
||||||
FactoryBot.send(strategy, factory_name, attributes)
|
FactoryBot.send(strategy, factory_name, attributes)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user