test: Improve test suite setup

Этот коммит содержится в:
Mattia Roccoberton
2025-04-13 15:00:22 +02:00
родитель 815491cb31
Коммит b38ce0713d
18 изменённых файлов: 114 добавлений и 209 удалений

Просмотреть файл

@@ -1,26 +1,23 @@
require_relative 'boot'
require 'rails/all'
require 'sprockets/railtie'
Bundler.require(*Rails.groups)
module Dummy
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0 if Rails::VERSION::MAJOR == 6
config.load_defaults Rails::VERSION::STRING.to_f
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
# -- all .rb files in that directory are automatically loaded after loading
# the framework and any gems in your application.
config.active_support.deprecation = :raise
###
if Gem::Version.new(Rails.version) < Gem::Version.new('7.1')
config.active_record.legacy_connection_handling = false
end
config.active_record.legacy_connection_handling = false if Gem::Version.new(Rails.version) < Gem::Version.new('7.1')
config.before_configuration do
ActiveSupport::Cache.format_version = 7.0 if Gem::Version.new(Rails.version) > Gem::Version.new('7.0')
if Gem::Version.new(Rails.version) > Gem::Version.new('7.0')
config.before_configuration do
ActiveSupport::Cache.format_version = 7.0
end
end
end
end

Просмотреть файл

@@ -6,7 +6,7 @@ default: &default
development:
<<: *default
database: db/development.sqlite3
schema_dump: schema_development.rb
schema_dump: schema-dev.rb
test:
<<: *default

Просмотреть файл

@@ -1,7 +1,9 @@
ActiveSupport::Reloader.to_prepare do
Rails.application.reloader.to_prepare do
ActiveStorage::Attachment.class_eval do
def self.ransackable_attributes(auth_object = nil)
%w[blob_id created_at id name record_id record_type]
class << self
def ransackable_attributes(auth_object = nil)
%w[blob_id created_at id name record_id record_type]
end
end
end
end