From 1b6a2acba67f1de0a2e1f30ee32a4401851cc1e6 Mon Sep 17 00:00:00 2001 From: Geremia Taglialatela Date: Thu, 31 Aug 2023 10:20:39 +0200 Subject: [PATCH] Improve test app creation - Remove unneeded libraries Also fixes an issue when running specs against Rails 5.2 / Ruby 2.2 because of a squiggly heredoc in active storage --- Rakefile | 2 +- spec/fixtures/railsapp/config/application.rb | 19 ++++++++++++------- .../config/environments/development.rb | 3 --- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/Rakefile b/Rakefile index 6665e969..25f3d73d 100644 --- a/Rakefile +++ b/Rakefile @@ -16,7 +16,7 @@ namespace :testapp do FileUtils.mkdir_p('tmp/aruba') Dir.chdir('tmp') do FileUtils.rm_rf('railsapp') - sh 'rails new railsapp --skip-bundle --skip-javascript --skip-webpack-install --skip-git' + sh 'rails new railsapp --skip-bundle --skip-javascript --skip-active-storage --skip-active-job --skip-action-text --skip-action-cable --skip-webpack-install --skip-git' end FileUtils.cp_r('spec/fixtures/railsapp/.', 'tmp/railsapp/') FileUtils.rm('tmp/railsapp/Gemfile') diff --git a/spec/fixtures/railsapp/config/application.rb b/spec/fixtures/railsapp/config/application.rb index b45bceea..31022102 100644 --- a/spec/fixtures/railsapp/config/application.rb +++ b/spec/fixtures/railsapp/config/application.rb @@ -1,17 +1,22 @@ require_relative 'boot' -require 'rails/all' +require "rails" +# Pick the frameworks you want: +require "active_model/railtie" +# require "active_job/railtie" +require "active_record/railtie" +# require "active_storage/engine" +require "action_controller/railtie" +# require "action_mailer/railtie" +require "action_view/railtie" +# require "action_cable/engine" +require "sprockets/railtie" +# require "rails/test_unit/railtie" -# Require the gems listed in Gemfile, including any gems -# you've limited to :test, :development, or :production. Bundler.require(*Rails.groups) module Railsapp class Application < Rails::Application - # Initialize configuration defaults for originally generated Rails version. config.active_record.schema_format = :sql - # Settings in config/environments/* take precedence over those specified here. - # Application configuration should go into files in config/initializers - # -- all .rb files in that directory are automatically loaded. end end diff --git a/spec/fixtures/railsapp/config/environments/development.rb b/spec/fixtures/railsapp/config/environments/development.rb index 6d4fb2c5..a201544e 100644 --- a/spec/fixtures/railsapp/config/environments/development.rb +++ b/spec/fixtures/railsapp/config/environments/development.rb @@ -12,9 +12,6 @@ # Show full error reports. config.consider_all_requests_local = true - # Don't care if the mailer can't send. - config.action_mailer.raise_delivery_errors = false - # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log