Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test app creation #212

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,22 @@ task :default => ['testapp:create', :spec]
namespace :testapp do
desc 'Create a dummy rails application for testing in /tmp'
task :create do
options = %w[
--skip-action-cable
--skip-action-text
--skip-active-job
--skip-active-storage
--skip-asset-pipeline
--skip-bundle
--skip-git
--skip-javascript
--skip-sprockets
--skip-webpack-install
]
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 #{options.join(' ')}"
end
FileUtils.cp_r('spec/fixtures/railsapp/.', 'tmp/railsapp/')
FileUtils.rm('tmp/railsapp/Gemfile')
Expand Down
19 changes: 12 additions & 7 deletions spec/fixtures/railsapp/config/application.rb
Original file line number Diff line number Diff line change
@@ -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
18 changes: 0 additions & 18 deletions spec/fixtures/railsapp/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,9 @@
# 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

# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load

# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true if Rails.version < '7.0'

# Suppress logger output for asset requests.
config.assets.quiet = true if Rails.version < '7.0'

# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
end
3 changes: 0 additions & 3 deletions spec/fixtures/railsapp/config/initializers/assets.rb

This file was deleted.