Skip to content

Commit 90fae8b

Browse files
committed
[test] Generate Rails stub tests for 5.0 through 8.0
(cherry picked from commit 7e9bb85)
1 parent 2a076a5 commit 90fae8b

17 files changed

Lines changed: 336 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class ApplicationController < ActionController::Base
2+
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3+
allow_browser versions: :modern
4+
end
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module ApplicationHelper
2+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require_relative "boot"
2+
3+
require "rails"
4+
# Pick the frameworks you want:
5+
require "active_model/railtie"
6+
# require "active_job/railtie"
7+
# require "active_record/railtie"
8+
# require "active_storage/engine"
9+
require "action_controller/railtie"
10+
# require "action_mailer/railtie"
11+
# require "action_mailbox/engine"
12+
# require "action_text/engine"
13+
require "action_view/railtie"
14+
# require "action_cable/engine"
15+
# require "rails/test_unit/railtie"
16+
17+
# Require the gems listed in Gemfile, including any gems
18+
# you've limited to :test, :development, or :production.
19+
Bundler.require(*Rails.groups)
20+
21+
module Rails80
22+
class Application < Rails::Application
23+
# Initialize configuration defaults for originally generated Rails version.
24+
config.load_defaults 8.0
25+
26+
# Please, add to the `ignore` list any other `lib` subdirectories that do
27+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
28+
# Common ones are `templates`, `generators`, or `middleware`, for example.
29+
config.autoload_lib(ignore: %w[assets tasks])
30+
31+
# Configuration for the application, engines, and railties goes here.
32+
#
33+
# These settings can be overridden in specific environments using the files
34+
# in config/environments, which are processed later.
35+
#
36+
# config.time_zone = "Central Time (US & Canada)"
37+
# config.eager_load_paths << Rails.root.join("extras")
38+
39+
# Don't generate system test files.
40+
config.generators.system_tests = nil
41+
end
42+
end
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2+
3+
require "bundler/setup" # Set up gems listed in the Gemfile.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
NCPB0BoQmoDBGNi6wTV45XD6wglzlWKz9UaJ+0/a4ByWCTVIwQ0TU7sBgXAqugWW122abcrrVuicT4K3/f3N4rGXSK7ub5ThDpY0q/+9NQrc1uYTLN5W8lAVjrO1mtk1uskK47hc8gvBXKRhOrxV1IGJazzXBgY2GA3fh6FtdUKMlKrUcq9TmmbGffCUOfqf1dD5KwDVPuwuavzFDbK32P3/Dvvjgh8FnfLms2QZo+WKp7/TtRxChonWkq/+AA/tKZZMFnKc4hbNA5tJfFL2NV2613UBj+nIITwxVxfFbhArKbR65S+3x5fwOVBl19TYT8SC/ITR9zOXQh/tNOJGZfEuQhKLYyIr+bbwoo0fDqvwExRiRbhg0rPccTpP+ISfE4HwAdKKi8v3MQht5J4bK3DWIx8OxPQFLaweCKZ187RH9dMkqJeMjQiUGzpcTXzJ+rkbDdRXPdpjOgsEi0+6BOHn84Tv5QTTvKwXky0bLjF8ffrfBZmThryy--pOOE0qME1o1qDga2--P86TbVCxNjPYcMsuRouaEg==
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Load the Rails application.
2+
require_relative "application"
3+
4+
# Initialize the Rails application.
5+
Rails.application.initialize!
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
require "active_support/core_ext/integer/time"
2+
3+
Rails.application.configure do
4+
# Settings specified here will take precedence over those in config/application.rb.
5+
6+
# Make code changes take effect immediately without server restart.
7+
config.enable_reloading = true
8+
9+
# Do not eager load code on boot.
10+
config.eager_load = false
11+
12+
# Show full error reports.
13+
config.consider_all_requests_local = true
14+
15+
# Enable server timing.
16+
config.server_timing = true
17+
18+
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19+
# Run rails dev:cache to toggle Action Controller caching.
20+
if Rails.root.join("tmp/caching-dev.txt").exist?
21+
config.action_controller.perform_caching = true
22+
config.action_controller.enable_fragment_cache_logging = true
23+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
24+
else
25+
config.action_controller.perform_caching = false
26+
end
27+
28+
# Change to :null_store to avoid any caching.
29+
config.cache_store = :memory_store
30+
31+
# Print deprecation notices to the Rails logger.
32+
config.active_support.deprecation = :log
33+
34+
# Raises error for missing translations.
35+
# config.i18n.raise_on_missing_translations = true
36+
37+
# Annotate rendered view with file names.
38+
config.action_view.annotate_rendered_view_with_filenames = true
39+
40+
# Raise error when a before_action's only/except options reference missing actions.
41+
config.action_controller.raise_on_missing_callback_actions = true
42+
end
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
require "active_support/core_ext/integer/time"
2+
3+
Rails.application.configure do
4+
# Settings specified here will take precedence over those in config/application.rb.
5+
6+
# Code is not reloaded between requests.
7+
config.enable_reloading = false
8+
9+
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
10+
config.eager_load = true
11+
12+
# Full error reports are disabled.
13+
config.consider_all_requests_local = false
14+
15+
# Turn on fragment caching in view templates.
16+
config.action_controller.perform_caching = true
17+
18+
# Cache assets for far-future expiry since they are all digest stamped.
19+
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
20+
21+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
22+
# config.asset_host = "http://assets.example.com"
23+
24+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
25+
config.assume_ssl = true
26+
27+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
28+
config.force_ssl = true
29+
30+
# Skip http-to-https redirect for the default health check endpoint.
31+
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
32+
33+
# Log to STDOUT with the current request id as a default log tag.
34+
config.log_tags = [ :request_id ]
35+
# config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
36+
37+
# Change to "debug" to log everything (including potentially personally-identifiable information!)
38+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
39+
40+
# Prevent health checks from clogging up the logs.
41+
config.silence_healthcheck_path = "/up"
42+
43+
# Don't log any deprecations.
44+
config.active_support.report_deprecations = false
45+
46+
# Replace the default in-process memory cache store with a durable alternative.
47+
# config.cache_store = :mem_cache_store
48+
49+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
50+
# the I18n.default_locale when a translation cannot be found).
51+
config.i18n.fallbacks = true
52+
53+
# Enable DNS rebinding protection and other `Host` header attacks.
54+
# config.hosts = [
55+
# "example.com", # Allow requests from example.com
56+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
57+
# ]
58+
#
59+
# Skip DNS rebinding protection for the default health check endpoint.
60+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
61+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# The test environment is used exclusively to run your application's
2+
# test suite. You never need to work with it otherwise. Remember that
3+
# your test database is "scratch space" for the test suite and is wiped
4+
# and recreated between test runs. Don't rely on the data there!
5+
6+
Rails.application.configure do
7+
# Settings specified here will take precedence over those in config/application.rb.
8+
9+
# While tests run files are not watched, reloading is not necessary.
10+
config.enable_reloading = false
11+
12+
# Eager loading loads your entire application. When running a single test locally,
13+
# this is usually not necessary, and can slow down your test suite. However, it's
14+
# recommended that you enable it in continuous integration systems to ensure eager
15+
# loading is working properly before deploying your code.
16+
config.eager_load = ENV["CI"].present?
17+
18+
# Configure public file server for tests with cache-control for performance.
19+
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
20+
21+
# Show full error reports.
22+
config.consider_all_requests_local = true
23+
config.cache_store = :null_store
24+
25+
# Render exception templates for rescuable exceptions and raise for other exceptions.
26+
config.action_dispatch.show_exceptions = :rescuable
27+
28+
# Disable request forgery protection in test environment.
29+
config.action_controller.allow_forgery_protection = false
30+
31+
# Print deprecation notices to the stderr.
32+
config.active_support.deprecation = :stderr
33+
34+
# Raises error for missing translations.
35+
# config.i18n.raise_on_missing_translations = true
36+
37+
# Annotate rendered view with file names.
38+
# config.action_view.annotate_rendered_view_with_filenames = true
39+
40+
# Raise error when a before_action's only/except options reference missing actions.
41+
config.action_controller.raise_on_missing_callback_actions = true
42+
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Be sure to restart your server when you modify this file.
2+
3+
# Define an application-wide content security policy.
4+
# See the Securing Rails Applications Guide for more information:
5+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
6+
7+
# Rails.application.configure do
8+
# config.content_security_policy do |policy|
9+
# policy.default_src :self, :https
10+
# policy.font_src :self, :https, :data
11+
# policy.img_src :self, :https, :data
12+
# policy.object_src :none
13+
# policy.script_src :self, :https
14+
# policy.style_src :self, :https
15+
# # Specify URI for violation reports
16+
# # policy.report_uri "/csp-violation-report-endpoint"
17+
# end
18+
#
19+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
22+
#
23+
# # Report violations without enforcing the policy.
24+
# # config.content_security_policy_report_only = true
25+
# end

0 commit comments

Comments
 (0)