railties 6.0.0 → 7.1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (286) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +699 -245
  3. data/MIT-LICENSE +1 -1
  4. data/RDOC_MAIN.md +99 -0
  5. data/README.rdoc +7 -8
  6. data/lib/minitest/rails_plugin.rb +80 -2
  7. data/lib/rails/all.rb +0 -1
  8. data/lib/rails/api/task.rb +37 -5
  9. data/lib/rails/app_updater.rb +9 -6
  10. data/lib/rails/application/bootstrap.rb +52 -14
  11. data/lib/rails/application/configuration.rb +327 -86
  12. data/lib/rails/application/default_middleware_stack.rb +33 -7
  13. data/lib/rails/application/dummy_config.rb +19 -0
  14. data/lib/rails/application/finisher.rb +94 -113
  15. data/lib/rails/application/routes_reloader.rb +17 -3
  16. data/lib/rails/application.rb +258 -201
  17. data/lib/rails/application_controller.rb +3 -4
  18. data/lib/rails/autoloaders/inflector.rb +21 -0
  19. data/lib/rails/autoloaders.rb +42 -42
  20. data/lib/rails/backtrace_cleaner.rb +13 -8
  21. data/lib/rails/cli.rb +5 -2
  22. data/lib/rails/code_statistics.rb +6 -4
  23. data/lib/rails/code_statistics_calculator.rb +16 -7
  24. data/lib/rails/command/actions.rb +10 -12
  25. data/lib/rails/command/base.rb +66 -46
  26. data/lib/rails/command/behavior.rb +3 -3
  27. data/lib/rails/command/environment_argument.rb +33 -17
  28. data/lib/rails/command/helpers/editor.rb +17 -12
  29. data/lib/rails/command.rb +90 -32
  30. data/lib/rails/commands/about/about_command.rb +14 -0
  31. data/lib/rails/commands/application/application_command.rb +2 -0
  32. data/lib/rails/commands/console/console_command.rb +17 -13
  33. data/lib/rails/commands/credentials/USAGE +54 -39
  34. data/lib/rails/commands/credentials/credentials_command/diffing.rb +53 -0
  35. data/lib/rails/commands/credentials/credentials_command.rb +83 -60
  36. data/lib/rails/commands/db/system/change/change_command.rb +8 -2
  37. data/lib/rails/commands/dbconsole/dbconsole_command.rb +39 -124
  38. data/lib/rails/commands/destroy/destroy_command.rb +3 -2
  39. data/lib/rails/commands/dev/dev_command.rb +1 -6
  40. data/lib/rails/commands/encrypted/USAGE +15 -20
  41. data/lib/rails/commands/encrypted/encrypted_command.rb +46 -35
  42. data/lib/rails/commands/gem_help/USAGE +16 -0
  43. data/lib/rails/commands/gem_help/gem_help_command.rb +13 -0
  44. data/lib/rails/commands/generate/generate_command.rb +3 -3
  45. data/lib/rails/commands/help/USAGE +15 -14
  46. data/lib/rails/commands/help/help_command.rb +21 -2
  47. data/lib/rails/commands/initializers/initializers_command.rb +1 -4
  48. data/lib/rails/commands/middleware/middleware_command.rb +17 -0
  49. data/lib/rails/commands/new/new_command.rb +2 -0
  50. data/lib/rails/commands/notes/notes_command.rb +5 -14
  51. data/lib/rails/commands/plugin/plugin_command.rb +2 -0
  52. data/lib/rails/commands/rake/rake_command.rb +27 -23
  53. data/lib/rails/commands/restart/restart_command.rb +14 -0
  54. data/lib/rails/commands/routes/routes_command.rb +13 -1
  55. data/lib/rails/commands/runner/USAGE +14 -12
  56. data/lib/rails/commands/runner/runner_command.rb +34 -21
  57. data/lib/rails/commands/secret/secret_command.rb +13 -0
  58. data/lib/rails/commands/secrets/USAGE +44 -43
  59. data/lib/rails/commands/secrets/secrets_command.rb +20 -38
  60. data/lib/rails/commands/server/server_command.rb +40 -64
  61. data/lib/rails/commands/test/USAGE +14 -0
  62. data/lib/rails/commands/test/test_command.rb +58 -16
  63. data/lib/rails/commands/unused_routes/unused_routes_command.rb +75 -0
  64. data/lib/rails/commands/version/version_command.rb +1 -0
  65. data/lib/rails/configuration.rb +53 -23
  66. data/lib/rails/console/app.rb +1 -4
  67. data/lib/rails/console/helpers.rb +2 -2
  68. data/lib/rails/deprecator.rb +7 -0
  69. data/lib/rails/engine/configuration.rb +54 -9
  70. data/lib/rails/engine/updater.rb +1 -1
  71. data/lib/rails/engine.rb +105 -81
  72. data/lib/rails/gem_version.rb +5 -5
  73. data/lib/rails/generators/actions/create_migration.rb +9 -5
  74. data/lib/rails/generators/actions.rb +275 -97
  75. data/lib/rails/generators/active_model.rb +28 -14
  76. data/lib/rails/generators/app_base.rb +487 -165
  77. data/lib/rails/generators/app_name.rb +3 -14
  78. data/lib/rails/generators/base.rb +42 -31
  79. data/lib/rails/generators/database.rb +41 -4
  80. data/lib/rails/generators/erb/mailer/mailer_generator.rb +0 -1
  81. data/lib/rails/generators/erb/mailer/templates/layout.html.erb.tt +1 -1
  82. data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +2 -1
  83. data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +11 -11
  84. data/lib/rails/generators/erb/scaffold/templates/edit.html.erb.tt +8 -4
  85. data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +11 -28
  86. data/lib/rails/generators/erb/scaffold/templates/new.html.erb.tt +7 -3
  87. data/lib/rails/generators/erb/scaffold/templates/partial.html.erb.tt +17 -0
  88. data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +8 -17
  89. data/lib/rails/generators/erb.rb +1 -2
  90. data/lib/rails/generators/generated_attribute.rb +60 -19
  91. data/lib/rails/generators/migration.rb +4 -8
  92. data/lib/rails/generators/model_helpers.rb +29 -4
  93. data/lib/rails/generators/named_base.rb +15 -15
  94. data/lib/rails/generators/rails/app/USAGE +23 -6
  95. data/lib/rails/generators/rails/app/app_generator.rb +151 -80
  96. data/lib/rails/generators/rails/app/templates/Dockerfile.tt +103 -0
  97. data/lib/rails/generators/rails/app/templates/Gemfile.tt +44 -54
  98. data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
  99. data/lib/rails/generators/rails/app/templates/app/assets/stylesheets/application.css.tt +2 -2
  100. data/lib/rails/generators/rails/app/templates/app/mailers/application_mailer.rb.tt +2 -2
  101. data/lib/rails/generators/rails/app/templates/app/models/application_record.rb.tt +1 -1
  102. data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +4 -9
  103. data/lib/rails/generators/rails/app/templates/app/views/layouts/mailer.html.erb.tt +1 -1
  104. data/lib/rails/generators/rails/app/templates/bin/rails.tt +3 -3
  105. data/lib/rails/generators/rails/app/templates/bin/rake.tt +2 -2
  106. data/lib/rails/generators/rails/app/templates/bin/setup.tt +19 -15
  107. data/lib/rails/generators/rails/app/templates/config/application.rb.tt +18 -23
  108. data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +3 -3
  109. data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +5 -6
  110. data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
  111. data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +17 -16
  112. data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +5 -5
  113. data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +12 -11
  114. data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
  115. data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +17 -18
  116. data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +4 -4
  117. data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +14 -13
  118. data/lib/rails/generators/rails/app/templates/config/databases/trilogy.yml.tt +59 -0
  119. data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
  120. data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +32 -14
  121. data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +42 -55
  122. data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +27 -15
  123. data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +3 -5
  124. data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +21 -28
  125. data/lib/rails/generators/rails/app/templates/config/initializers/cors.rb.tt +3 -3
  126. data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +6 -2
  127. data/lib/rails/generators/rails/app/templates/config/initializers/inflections.rb.tt +4 -4
  128. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_7_1.rb.tt +284 -0
  129. data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +13 -0
  130. data/lib/rails/generators/rails/app/templates/config/locales/en.yml +13 -15
  131. data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +17 -20
  132. data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +8 -1
  133. data/lib/rails/generators/rails/app/templates/config/storage.yml.tt +5 -5
  134. data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
  135. data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +7 -5
  136. data/lib/rails/generators/rails/app/templates/docker-entrypoint.tt +10 -0
  137. data/lib/rails/generators/rails/app/templates/dockerignore.tt +43 -0
  138. data/lib/rails/generators/rails/app/templates/gitattributes.tt +9 -0
  139. data/lib/rails/generators/rails/app/templates/gitignore.tt +12 -9
  140. data/lib/rails/generators/rails/app/templates/node-version.tt +1 -0
  141. data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +10 -8
  142. data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +13 -11
  143. data/lib/rails/generators/rails/application_record/application_record_generator.rb +4 -0
  144. data/lib/rails/generators/rails/benchmark/USAGE +19 -0
  145. data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +30 -0
  146. data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
  147. data/lib/rails/generators/rails/controller/USAGE +13 -5
  148. data/lib/rails/generators/rails/controller/controller_generator.rb +7 -42
  149. data/lib/rails/generators/rails/controller/templates/controller.rb.tt +1 -5
  150. data/lib/rails/generators/rails/credentials/credentials_generator.rb +30 -25
  151. data/lib/rails/generators/rails/credentials/templates/credentials.yml.tt +8 -0
  152. data/lib/rails/generators/rails/db/system/change/change_generator.rb +31 -1
  153. data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +6 -2
  154. data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -2
  155. data/lib/rails/generators/rails/generator/USAGE +2 -2
  156. data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
  157. data/lib/rails/generators/rails/generator/templates/%file_name%_generator.rb.tt +1 -1
  158. data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
  159. data/lib/rails/generators/rails/helper/USAGE +2 -3
  160. data/lib/rails/generators/rails/integration_test/USAGE +2 -2
  161. data/lib/rails/generators/rails/migration/USAGE +22 -12
  162. data/lib/rails/generators/rails/model/model_generator.rb +4 -0
  163. data/lib/rails/generators/rails/plugin/USAGE +17 -6
  164. data/lib/rails/generators/rails/plugin/plugin_generator.rb +86 -46
  165. data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +15 -20
  166. data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +10 -39
  167. data/lib/rails/generators/rails/plugin/templates/MIT-LICENSE.tt +1 -1
  168. data/lib/rails/generators/rails/plugin/templates/README.md.tt +1 -1
  169. data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
  170. data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +0 -1
  171. data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +2 -2
  172. data/lib/rails/generators/rails/plugin/templates/app/views/layouts/%namespaced_name%/application.html.erb.tt +0 -3
  173. data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +7 -22
  174. data/lib/rails/generators/rails/plugin/templates/gitignore.tt +10 -14
  175. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +2 -2
  176. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/version.rb.tt +1 -1
  177. data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
  178. data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +3 -3
  179. data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
  180. data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
  181. data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +6 -14
  182. data/lib/rails/generators/rails/resource/USAGE +4 -4
  183. data/lib/rails/generators/rails/resource/resource_generator.rb +6 -0
  184. data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
  185. data/lib/rails/generators/rails/scaffold/USAGE +5 -5
  186. data/lib/rails/generators/rails/scaffold/scaffold_generator.rb +2 -20
  187. data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
  188. data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +7 -2
  189. data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -6
  190. data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +7 -11
  191. data/lib/rails/generators/rails/system_test/USAGE +2 -2
  192. data/lib/rails/generators/rails/task/USAGE +3 -3
  193. data/lib/rails/generators/resource_helpers.rb +2 -2
  194. data/lib/rails/generators/test_case.rb +3 -3
  195. data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
  196. data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
  197. data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
  198. data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +3 -3
  199. data/lib/rails/generators/test_unit/integration/integration_generator.rb +0 -1
  200. data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
  201. data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
  202. data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
  203. data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
  204. data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
  205. data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
  206. data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
  207. data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +4 -5
  208. data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +6 -6
  209. data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +8 -8
  210. data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +9 -11
  211. data/lib/rails/generators/testing/assertions.rb +2 -2
  212. data/lib/rails/generators/testing/{behaviour.rb → behavior.rb} +8 -7
  213. data/lib/rails/generators.rb +43 -45
  214. data/lib/rails/health_controller.rb +55 -0
  215. data/lib/rails/info.rb +4 -4
  216. data/lib/rails/info_controller.rb +30 -13
  217. data/lib/rails/initializable.rb +1 -1
  218. data/lib/rails/mailers_controller.rb +18 -9
  219. data/lib/rails/paths.rb +28 -19
  220. data/lib/rails/rack/logger.rb +17 -17
  221. data/lib/rails/rackup/server.rb +15 -0
  222. data/lib/rails/railtie/configurable.rb +0 -1
  223. data/lib/rails/railtie/configuration.rb +15 -3
  224. data/lib/rails/railtie.rb +80 -37
  225. data/lib/rails/ruby_version_check.rb +5 -3
  226. data/lib/rails/secrets.rb +14 -9
  227. data/lib/rails/source_annotation_extractor.rb +69 -34
  228. data/lib/rails/tasks/engine.rake +8 -11
  229. data/lib/rails/tasks/framework.rake +4 -6
  230. data/lib/rails/tasks/log.rake +1 -1
  231. data/lib/rails/tasks/misc.rake +4 -15
  232. data/lib/rails/tasks/statistics.rake +9 -6
  233. data/lib/rails/tasks/tmp.rake +13 -6
  234. data/lib/rails/tasks/yarn.rake +17 -6
  235. data/lib/rails/tasks/zeitwerk.rake +16 -41
  236. data/lib/rails/tasks.rb +0 -6
  237. data/lib/rails/templates/layouts/application.html.erb +15 -0
  238. data/lib/rails/templates/rails/mailers/email.html.erb +46 -11
  239. data/lib/rails/templates/rails/mailers/index.html.erb +14 -7
  240. data/lib/rails/templates/rails/mailers/mailer.html.erb +11 -5
  241. data/lib/rails/templates/rails/welcome/index.html.erb +65 -48
  242. data/lib/rails/test_help.rb +13 -14
  243. data/lib/rails/test_unit/line_filtering.rb +1 -1
  244. data/lib/rails/test_unit/railtie.rb +0 -4
  245. data/lib/rails/test_unit/reporter.rb +8 -3
  246. data/lib/rails/test_unit/runner.rb +61 -19
  247. data/lib/rails/test_unit/test_parser.rb +88 -0
  248. data/lib/rails/test_unit/testing.rake +17 -36
  249. data/lib/rails/testing/maintain_test_schema.rb +16 -0
  250. data/lib/rails/version.rb +1 -1
  251. data/lib/rails/welcome_controller.rb +1 -0
  252. data/lib/rails/zeitwerk_checker.rb +15 -0
  253. data/lib/rails.rb +31 -23
  254. metadata +89 -58
  255. data/RDOC_MAIN.rdoc +0 -98
  256. data/lib/rails/application/dummy_erb_compiler.rb +0 -18
  257. data/lib/rails/command/spellchecker.rb +0 -58
  258. data/lib/rails/generators/css/assets/assets_generator.rb +0 -15
  259. data/lib/rails/generators/css/assets/templates/stylesheet.css +0 -4
  260. data/lib/rails/generators/css/scaffold/scaffold_generator.rb +0 -18
  261. data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +0 -6
  262. data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +0 -5
  263. data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +0 -23
  264. data/lib/rails/generators/rails/app/templates/bin/yarn.tt +0 -10
  265. data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
  266. data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
  267. data/lib/rails/generators/rails/app/templates/config/initializers/application_controller_renderer.rb.tt +0 -8
  268. data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +0 -7
  269. data/lib/rails/generators/rails/app/templates/config/initializers/cookies_serializer.rb.tt +0 -5
  270. data/lib/rails/generators/rails/app/templates/config/initializers/mime_types.rb.tt +0 -4
  271. data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_0.rb.tt +0 -45
  272. data/lib/rails/generators/rails/app/templates/config/initializers/wrap_parameters.rb.tt +0 -16
  273. data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +0 -6
  274. data/lib/rails/generators/rails/app/templates/package.json.tt +0 -11
  275. data/lib/rails/generators/rails/assets/USAGE +0 -17
  276. data/lib/rails/generators/rails/assets/assets_generator.rb +0 -26
  277. data/lib/rails/generators/rails/assets/templates/stylesheet.css +0 -4
  278. data/lib/rails/generators/rails/model/USAGE +0 -114
  279. data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
  280. data/lib/rails/generators/rails/scaffold/templates/scaffold.css +0 -80
  281. data/lib/rails/tasks/annotations.rake +0 -22
  282. data/lib/rails/tasks/dev.rake +0 -11
  283. data/lib/rails/tasks/initializers.rake +0 -9
  284. data/lib/rails/tasks/middleware.rake +0 -9
  285. data/lib/rails/tasks/restart.rake +0 -9
  286. data/lib/rails/tasks/routes.rake +0 -9
@@ -0,0 +1,284 @@
1
+ # Be sure to restart your server when you modify this file.
2
+ #
3
+ # This file eases your Rails 7.1 framework defaults upgrade.
4
+ #
5
+ # Uncomment each configuration one by one to switch to the new default.
6
+ # Once your application is ready to run with all new defaults, you can remove
7
+ # this file and set the `config.load_defaults` to `7.1`.
8
+ #
9
+ # Read the Guide for Upgrading Ruby on Rails for more info on each option.
10
+ # https://guides.rubyonrails.org/upgrading_ruby_on_rails.html
11
+
12
+ ###
13
+ # No longer add autoloaded paths into `$LOAD_PATH`. This means that you won't be able
14
+ # to manually require files that are managed by the autoloader, which you shouldn't do anyway.
15
+ #
16
+ # This will reduce the size of the load path, making `require` faster if you don't use bootsnap, or reduce the size
17
+ # of the bootsnap cache if you use it.
18
+ #
19
+ # To set this configuration, add the following line to `config/application.rb` (NOT this file):
20
+ # config.add_autoload_paths_to_load_path = false
21
+
22
+ ###
23
+ # Remove the default X-Download-Options headers since it is used only by Internet Explorer.
24
+ # If you need to support Internet Explorer, add back `"X-Download-Options" => "noopen"`.
25
+ #++
26
+ # Rails.application.config.action_dispatch.default_headers = {
27
+ # "X-Frame-Options" => "SAMEORIGIN",
28
+ # "X-XSS-Protection" => "0",
29
+ # "X-Content-Type-Options" => "nosniff",
30
+ # "X-Permitted-Cross-Domain-Policies" => "none",
31
+ # "Referrer-Policy" => "strict-origin-when-cross-origin"
32
+ # }
33
+
34
+ ###
35
+ # Do not treat an `ActionController::Parameters` instance
36
+ # as equal to an equivalent `Hash` by default.
37
+ #++
38
+ # Rails.application.config.action_controller.allow_deprecated_parameters_hash_equality = false
39
+
40
+ ###
41
+ # Active Record Encryption now uses SHA-256 as its hash digest algorithm.
42
+ #
43
+ # There are 3 scenarios to consider.
44
+ #
45
+ # 1. If you have data encrypted with previous Rails versions, and you have
46
+ # +config.active_support.key_generator_hash_digest_class+ configured as SHA1 (the default
47
+ # before Rails 7.0), you need to configure SHA-1 for Active Record Encryption too:
48
+ #++
49
+ # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA1
50
+ #
51
+ # 2. If you have +config.active_support.key_generator_hash_digest_class+ configured as SHA256 (the new default
52
+ # in 7.0), then you need to configure SHA-256 for Active Record Encryption:
53
+ #++
54
+ # Rails.application.config.active_record.encryption.hash_digest_class = OpenSSL::Digest::SHA256
55
+ #
56
+ # 3. If you don't currently have data encrypted with Active Record encryption, you can disable this setting to
57
+ # configure the default behavior starting 7.1+:
58
+ #++
59
+ # Rails.application.config.active_record.encryption.support_sha1_for_non_deterministic_encryption = false
60
+
61
+ ###
62
+ # No longer run after_commit callbacks on the first of multiple Active Record
63
+ # instances to save changes to the same database row within a transaction.
64
+ # Instead, run these callbacks on the instance most likely to have internal
65
+ # state which matches what was committed to the database, typically the last
66
+ # instance to save.
67
+ #++
68
+ # Rails.application.config.active_record.run_commit_callbacks_on_first_saved_instances_in_transaction = false
69
+
70
+ ###
71
+ # Configures SQLite with a strict strings mode, which disables double-quoted string literals.
72
+ #
73
+ # SQLite has some quirks around double-quoted string literals.
74
+ # It first tries to consider double-quoted strings as identifier names, but if they don't exist
75
+ # it then considers them as string literals. Because of this, typos can silently go unnoticed.
76
+ # For example, it is possible to create an index for a non existing column.
77
+ # See https://www.sqlite.org/quirks.html#double_quoted_string_literals_are_accepted for more details.
78
+ #++
79
+ # Rails.application.config.active_record.sqlite3_adapter_strict_strings_by_default = true
80
+
81
+ ###
82
+ # Disable deprecated singular associations names.
83
+ #++
84
+ # Rails.application.config.active_record.allow_deprecated_singular_associations_name = false
85
+
86
+ ###
87
+ # Enable the Active Job `BigDecimal` argument serializer, which guarantees
88
+ # roundtripping. Without this serializer, some queue adapters may serialize
89
+ # `BigDecimal` arguments as simple (non-roundtrippable) strings.
90
+ #
91
+ # When deploying an application with multiple replicas, old (pre-Rails 7.1)
92
+ # replicas will not be able to deserialize `BigDecimal` arguments from this
93
+ # serializer. Therefore, this setting should only be enabled after all replicas
94
+ # have been successfully upgraded to Rails 7.1.
95
+ #++
96
+ # Rails.application.config.active_job.use_big_decimal_serializer = true
97
+
98
+ ###
99
+ # Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or
100
+ # `write` are given an invalid `expires_at` or `expires_in` time.
101
+ # Options are `true`, and `false`. If `false`, the exception will be reported
102
+ # as `handled` and logged instead.
103
+ #++
104
+ # Rails.application.config.active_support.raise_on_invalid_cache_expiration_time = true
105
+
106
+ ###
107
+ # Specify whether Query Logs will format tags using the SQLCommenter format
108
+ # (https://open-telemetry.github.io/opentelemetry-sqlcommenter/), or using the legacy format.
109
+ # Options are `:legacy` and `:sqlcommenter`.
110
+ #++
111
+ # Rails.application.config.active_record.query_log_tags_format = :sqlcommenter
112
+
113
+ ###
114
+ # Specify the default serializer used by `MessageEncryptor` and `MessageVerifier`
115
+ # instances.
116
+ #
117
+ # The legacy default is `:marshal`, which is a potential vector for
118
+ # deserialization attacks in cases where a message signing secret has been
119
+ # leaked.
120
+ #
121
+ # In Rails 7.1, the new default is `:json_allow_marshal` which serializes and
122
+ # deserializes with `ActiveSupport::JSON`, but can fall back to deserializing
123
+ # with `Marshal` so that legacy messages can still be read.
124
+ #
125
+ # In Rails 7.2, the default will become `:json` which serializes and
126
+ # deserializes with `ActiveSupport::JSON` only.
127
+ #
128
+ # Alternatively, you can choose `:message_pack` or `:message_pack_allow_marshal`,
129
+ # which serialize with `ActiveSupport::MessagePack`. `ActiveSupport::MessagePack`
130
+ # can roundtrip some Ruby types that are not supported by JSON, and may provide
131
+ # improved performance, but it requires the `msgpack` gem.
132
+ #
133
+ # For more information, see
134
+ # https://guides.rubyonrails.org/v7.1/configuring.html#config-active-support-message-serializer
135
+ #
136
+ # If you are performing a rolling deploy of a Rails 7.1 upgrade, wherein servers
137
+ # that have not yet been upgraded must be able to read messages from upgraded
138
+ # servers, first deploy without changing the serializer, then set the serializer
139
+ # in a subsequent deploy.
140
+ #++
141
+ # Rails.application.config.active_support.message_serializer = :json_allow_marshal
142
+
143
+ ###
144
+ # Enable a performance optimization that serializes message data and metadata
145
+ # together. This changes the message format, so messages serialized this way
146
+ # cannot be read by older versions of Rails. However, messages that use the old
147
+ # format can still be read, regardless of whether this optimization is enabled.
148
+ #
149
+ # To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
150
+ # not yet been upgraded must be able to read messages from upgraded servers,
151
+ # leave this optimization off on the first deploy, then enable it on a
152
+ # subsequent deploy.
153
+ #++
154
+ # Rails.application.config.active_support.use_message_serializer_for_metadata = true
155
+
156
+ ###
157
+ # Set the maximum size for Rails log files.
158
+ #
159
+ # `config.load_defaults 7.1` does not set this value for environments other than
160
+ # development and test.
161
+ #++
162
+ # if Rails.env.local?
163
+ # Rails.application.config.log_file_size = 100 * 1024 * 1024
164
+ # end
165
+
166
+ ###
167
+ # Enable raising on assignment to attr_readonly attributes. The previous
168
+ # behavior would allow assignment but silently not persist changes to the
169
+ # database.
170
+ #++
171
+ # Rails.application.config.active_record.raise_on_assign_to_attr_readonly = true
172
+
173
+ ###
174
+ # Enable validating only parent-related columns for presence when the parent is mandatory.
175
+ # The previous behavior was to validate the presence of the parent record, which performed an extra query
176
+ # to get the parent every time the child record was updated, even when parent has not changed.
177
+ #++
178
+ # Rails.application.config.active_record.belongs_to_required_validates_foreign_key = false
179
+
180
+ ###
181
+ # Enable precompilation of `config.filter_parameters`. Precompilation can
182
+ # improve filtering performance, depending on the quantity and types of filters.
183
+ #++
184
+ # Rails.application.config.precompile_filter_parameters = true
185
+
186
+ ###
187
+ # Enable before_committed! callbacks on all enrolled records in a transaction.
188
+ # The previous behavior was to only run the callbacks on the first copy of a record
189
+ # if there were multiple copies of the same record enrolled in the transaction.
190
+ #++
191
+ # Rails.application.config.active_record.before_committed_on_all_records = true
192
+
193
+ ###
194
+ # Disable automatic column serialization into YAML.
195
+ # To keep the historic behavior, you can set it to `YAML`, however it is
196
+ # recommended to explicitly define the serialization method for each column
197
+ # rather than to rely on a global default.
198
+ #++
199
+ # Rails.application.config.active_record.default_column_serializer = nil
200
+
201
+ ###
202
+ # Enable a performance optimization that serializes Active Record models
203
+ # in a faster and more compact way.
204
+ #
205
+ # To perform a rolling deploy of a Rails 7.1 upgrade, wherein servers that have
206
+ # not yet been upgraded must be able to read caches from upgraded servers,
207
+ # leave this optimization off on the first deploy, then enable it on a
208
+ # subsequent deploy.
209
+ #++
210
+ # Rails.application.config.active_record.marshalling_format_version = 7.1
211
+
212
+ ###
213
+ # Run `after_commit` and `after_*_commit` callbacks in the order they are defined in a model.
214
+ # This matches the behaviour of all other callbacks.
215
+ # In previous versions of Rails, they ran in the inverse order.
216
+ #++
217
+ # Rails.application.config.active_record.run_after_transaction_callbacks_in_order_defined = true
218
+
219
+ ###
220
+ # Whether a `transaction` block is committed or rolled back when exited via `return`, `break` or `throw`.
221
+ #++
222
+ # Rails.application.config.active_record.commit_transaction_on_non_local_return = true
223
+
224
+ ###
225
+ # Controls when to generate a value for <tt>has_secure_token</tt> declarations.
226
+ #++
227
+ # Rails.application.config.active_record.generate_secure_token_on = :initialize
228
+
229
+ ###
230
+ # ** Please read carefully, this must be configured in config/application.rb **
231
+ #
232
+ # Change the format of the cache entry.
233
+ #
234
+ # Changing this default means that all new cache entries added to the cache
235
+ # will have a different format that is not supported by Rails 7.0
236
+ # applications.
237
+ #
238
+ # Only change this value after your application is fully deployed to Rails 7.1
239
+ # and you have no plans to rollback.
240
+ # When you're ready to change format, add this to `config/application.rb` (NOT
241
+ # this file):
242
+ # config.active_support.cache_format_version = 7.1
243
+
244
+
245
+ ###
246
+ # Configure Action View to use HTML5 standards-compliant sanitizers when they are supported on your
247
+ # platform.
248
+ #
249
+ # `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action View to use HTML5-compliant
250
+ # sanitizers if they are supported, else fall back to HTML4 sanitizers.
251
+ #
252
+ # In previous versions of Rails, Action View always used `Rails::HTML4::Sanitizer` as its vendor.
253
+ #++
254
+ # Rails.application.config.action_view.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
255
+
256
+
257
+ ###
258
+ # Configure Action Text to use an HTML5 standards-compliant sanitizer when it is supported on your
259
+ # platform.
260
+ #
261
+ # `Rails::HTML::Sanitizer.best_supported_vendor` will cause Action Text to use HTML5-compliant
262
+ # sanitizers if they are supported, else fall back to HTML4 sanitizers.
263
+ #
264
+ # In previous versions of Rails, Action Text always used `Rails::HTML4::Sanitizer` as its vendor.
265
+ #++
266
+ # Rails.application.config.action_text.sanitizer_vendor = Rails::HTML::Sanitizer.best_supported_vendor
267
+
268
+
269
+ ###
270
+ # Configure the log level used by the DebugExceptions middleware when logging
271
+ # uncaught exceptions during requests.
272
+ #++
273
+ # Rails.application.config.action_dispatch.debug_exception_log_level = :error
274
+
275
+
276
+ ###
277
+ # Configure the test helpers in Action View, Action Dispatch, and rails-dom-testing to use HTML5
278
+ # parsers.
279
+ #
280
+ # Nokogiri::HTML5 isn't supported on JRuby, so JRuby applications must set this to :html4.
281
+ #
282
+ # In previous versions of Rails, these test helpers always used an HTML4 parser.
283
+ #++
284
+ # Rails.application.config.dom_testing_default_html_version = :html5
@@ -0,0 +1,13 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide HTTP permissions policy. For further
4
+ # information see: https://developers.google.com/web/updates/2018/06/feature-policy
5
+
6
+ # Rails.application.config.permissions_policy do |policy|
7
+ # policy.camera :none
8
+ # policy.gyroscope :none
9
+ # policy.microphone :none
10
+ # policy.usb :none
11
+ # policy.fullscreen :self
12
+ # policy.payment :self, "https://secure.example.com"
13
+ # end
@@ -1,14 +1,14 @@
1
- # Files in the config/locales directory are used for internationalization
2
- # and are automatically loaded by Rails. If you want to use locales other
3
- # than English, add the necessary files in this directory.
1
+ # Files in the config/locales directory are used for internationalization and
2
+ # are automatically loaded by Rails. If you want to use locales other than
3
+ # English, add the necessary files in this directory.
4
4
  #
5
5
  # To use the locales, use `I18n.t`:
6
6
  #
7
- # I18n.t 'hello'
7
+ # I18n.t "hello"
8
8
  #
9
9
  # In views, this is aliased to just `t`:
10
10
  #
11
- # <%= t('hello') %>
11
+ # <%= t("hello") %>
12
12
  #
13
13
  # To use a different locale, set it with `I18n.locale`:
14
14
  #
@@ -16,18 +16,16 @@
16
16
  #
17
17
  # This would use the information in config/locales/es.yml.
18
18
  #
19
- # The following keys must be escaped otherwise they will not be retrieved by
20
- # the default I18n backend:
19
+ # To learn more about the API, please read the Rails Internationalization guide
20
+ # at https://guides.rubyonrails.org/i18n.html.
21
21
  #
22
- # true, false, on, off, yes, no
22
+ # Be aware that YAML interprets the following case-insensitive strings as
23
+ # booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24
+ # must be quoted to be interpreted as strings. For example:
23
25
  #
24
- # Instead, surround them with single quotes.
25
- #
26
- # en:
27
- # 'true': 'foo'
28
- #
29
- # To learn more, please read the Rails Internationalization guide
30
- # available at https://guides.rubyonrails.org/i18n.html.
26
+ # en:
27
+ # "yes": yup
28
+ # enabled: "ON"
31
29
 
32
30
  en:
33
31
  hello: "Hello world"
@@ -1,38 +1,35 @@
1
+ # This configuration file will be evaluated by Puma. The top-level methods that
2
+ # are invoked here are part of Puma's configuration DSL. For more information
3
+ # about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4
+
1
5
  # Puma can serve each request in a thread from an internal thread pool.
2
6
  # The `threads` method setting takes two numbers: a minimum and maximum.
3
7
  # Any libraries that use thread pools should be configured to match
4
8
  # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
9
  # and maximum; this matches the default thread size of Active Record.
6
- #
7
10
  max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
11
  min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9
12
  threads min_threads_count, max_threads_count
10
13
 
14
+ # Specifies that the worker count should equal the number of processors in production.
15
+ if ENV["RAILS_ENV"] == "production"
16
+ require "concurrent-ruby"
17
+ worker_count = Integer(ENV.fetch("WEB_CONCURRENCY") { Concurrent.physical_processor_count })
18
+ workers worker_count if worker_count > 1
19
+ end
20
+
21
+ # Specifies the `worker_timeout` threshold that Puma will use to wait before
22
+ # terminating a worker in development environments.
23
+ worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
24
+
11
25
  # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
12
- #
13
- port ENV.fetch("PORT") { 3000 }
26
+ port ENV.fetch("PORT") { 3000 }
14
27
 
15
28
  # Specifies the `environment` that Puma will run in.
16
- #
17
29
  environment ENV.fetch("RAILS_ENV") { "development" }
18
30
 
19
31
  # Specifies the `pidfile` that Puma will use.
20
32
  pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
21
33
 
22
- # Specifies the number of `workers` to boot in clustered mode.
23
- # Workers are forked web server processes. If using threads and workers together
24
- # the concurrency of the application would be max `threads` * `workers`.
25
- # Workers do not work on JRuby or Windows (both of which do not support
26
- # processes).
27
- #
28
- # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
29
-
30
- # Use the `preload_app!` method when specifying a `workers` number.
31
- # This directive tells Puma to first boot the application and load code
32
- # before forking the application. This takes advantage of Copy On Write
33
- # process behavior so workers use less memory.
34
- #
35
- # preload_app!
36
-
37
- # Allow puma to be restarted by `rails restart` command.
34
+ # Allow puma to be restarted by `bin/rails restart` command.
38
35
  plugin :tmp_restart
@@ -1,3 +1,10 @@
1
1
  Rails.application.routes.draw do
2
- # For details on the DSL available within this file, see https://guides.rubyonrails.org/routing.html
2
+ # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
3
+
4
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
5
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
6
+ get "up" => "rails/health#show", as: :rails_health_check
7
+
8
+ # Defines the root path route ("/")
9
+ # root "posts#index"
3
10
  end
@@ -6,27 +6,27 @@ local:
6
6
  service: Disk
7
7
  root: <%%= Rails.root.join("storage") %>
8
8
 
9
- # Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
9
+ # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
10
  # amazon:
11
11
  # service: S3
12
12
  # access_key_id: <%%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
13
  # secret_access_key: <%%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
14
  # region: us-east-1
15
- # bucket: your_own_bucket
15
+ # bucket: your_own_bucket-<%%= Rails.env %>
16
16
 
17
17
  # Remember not to checkin your GCS keyfile to a repository
18
18
  # google:
19
19
  # service: GCS
20
20
  # project: your_project
21
21
  # credentials: <%%= Rails.root.join("path/to/gcs.keyfile") %>
22
- # bucket: your_own_bucket
22
+ # bucket: your_own_bucket-<%%= Rails.env %>
23
23
 
24
- # Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
24
+ # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
25
  # microsoft:
26
26
  # service: AzureStorage
27
27
  # storage_account_name: your_account_name
28
28
  # storage_access_key: <%%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
- # container: your_container_name
29
+ # container: your_container_name-<%%= Rails.env %>
30
30
 
31
31
  # mirror:
32
32
  # service: Mirror
@@ -1,5 +1,6 @@
1
1
  # This file is used by Rack-based servers to start the application.
2
2
 
3
- require_relative 'config/environment'
3
+ require_relative "config/environment"
4
4
 
5
5
  run Rails.application
6
+ Rails.application.load_server
@@ -1,7 +1,9 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
1
+ # This file should ensure the existence of records required to run the application in every environment (production,
2
+ # development, test). The code here should be idempotent so that it can be executed at any point in every environment.
3
+ # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3
4
  #
4
- # Examples:
5
+ # Example:
5
6
  #
6
- # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7
- # Character.create(name: 'Luke', movie: movies.first)
7
+ # ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
8
+ # MovieGenre.find_or_create_by!(name: genre_name)
9
+ # end
@@ -0,0 +1,10 @@
1
+ #!/bin/bash -e
2
+
3
+ <% unless skip_active_record? -%>
4
+ # If running the rails server then create or migrate existing database
5
+ if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
6
+ ./bin/rails db:prepare
7
+ fi
8
+
9
+ <% end -%>
10
+ exec "${@}"
@@ -0,0 +1,43 @@
1
+ # See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2
+
3
+ # Ignore git directory.
4
+ /.git/
5
+
6
+ # Ignore bundler config.
7
+ /.bundle
8
+
9
+ # Ignore all environment files (except templates).
10
+ /.env*
11
+ !/.env*.erb
12
+
13
+ # Ignore all default key files.
14
+ /config/master.key
15
+ /config/credentials/*.key
16
+
17
+ # Ignore all logfiles and tempfiles.
18
+ /log/*
19
+ /tmp/*
20
+ <% if keeps? -%>
21
+ !/log/.keep
22
+ !/tmp/.keep
23
+
24
+ # Ignore pidfiles, but keep the directory.
25
+ /tmp/pids/*
26
+ !/tmp/pids/.keep
27
+ <% end -%>
28
+
29
+ # Ignore storage (uploaded files in development and any SQLite databases).
30
+ /storage/*
31
+ <% if keeps? -%>
32
+ !/storage/.keep
33
+ /tmp/storage/*
34
+ !/tmp/storage/.keep
35
+ <% end -%>
36
+ <% unless options.api? -%>
37
+
38
+ # Ignore assets.
39
+ /node_modules/
40
+ /app/assets/builds/*
41
+ !/app/assets/builds/.keep
42
+ /public/assets
43
+ <% end -%>
@@ -0,0 +1,9 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ <% unless options[:skip_active_record] -%>
4
+ # Mark the database schema as having been generated.
5
+ db/schema.rb linguist-generated
6
+ <% end -%>
7
+
8
+ # Mark any vendored files as having been vendored.
9
+ vendor/* linguist-vendored
@@ -7,29 +7,32 @@
7
7
  # Ignore bundler config.
8
8
  /.bundle
9
9
 
10
- <% if sqlite3? -%>
11
- # Ignore the default SQLite database.
12
- /db/*.sqlite3
13
- /db/*.sqlite3-journal
10
+ # Ignore all environment files (except templates).
11
+ /.env*
12
+ !/.env*.erb
14
13
 
15
- <% end -%>
16
14
  # Ignore all logfiles and tempfiles.
17
15
  /log/*
18
16
  /tmp/*
19
17
  <% if keeps? -%>
20
18
  !/log/.keep
21
19
  !/tmp/.keep
20
+
21
+ # Ignore pidfiles, but keep the directory.
22
+ /tmp/pids/*
23
+ !/tmp/pids/
24
+ !/tmp/pids/.keep
22
25
  <% end -%>
23
26
 
24
- <% unless skip_active_storage? -%>
25
- # Ignore uploaded files in development.
27
+ # Ignore storage (uploaded files in development and any SQLite databases).
26
28
  /storage/*
27
29
  <% if keeps? -%>
28
30
  !/storage/.keep
29
- <% end -%>
31
+ /tmp/storage/*
32
+ !/tmp/storage/
33
+ !/tmp/storage/.keep
30
34
  <% end -%>
31
35
  <% unless options.api? -%>
32
36
 
33
37
  /public/assets
34
38
  <% end -%>
35
- .byebug_history
@@ -0,0 +1 @@
1
+ <%= node_version %>
@@ -1,11 +1,13 @@
1
1
  require "test_helper"
2
2
 
3
- class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
4
- # test "connects with cookies" do
5
- # cookies.signed[:user_id] = 42
6
- #
7
- # connect
8
- #
9
- # assert_equal connection.user_id, "42"
10
- # end
3
+ module ApplicationCable
4
+ class ConnectionTest < ActionCable::Connection::TestCase
5
+ # test "connects with cookies" do
6
+ # cookies.signed[:user_id] = 42
7
+ #
8
+ # connect
9
+ #
10
+ # assert_equal connection.user_id, "42"
11
+ # end
12
+ end
11
13
  end
@@ -1,19 +1,21 @@
1
- ENV['RAILS_ENV'] ||= 'test'
2
- require_relative '../config/environment'
3
- require 'rails/test_help'
1
+ ENV["RAILS_ENV"] ||= "test"
2
+ require_relative "../config/environment"
3
+ require "rails/test_help"
4
4
 
5
- class ActiveSupport::TestCase
6
- # Run tests in parallel with specified workers
7
- <% if defined?(JRUBY_VERSION) || Gem.win_platform? -%>
8
- parallelize(workers: :number_of_processors, with: :threads)
5
+ module ActiveSupport
6
+ class TestCase
7
+ # Run tests in parallel with specified workers
8
+ <% if Process.respond_to?(:fork) && !Gem.win_platform? -%>
9
+ parallelize(workers: :number_of_processors)
9
10
  <%- else -%>
10
- parallelize(workers: :number_of_processors)
11
+ parallelize(workers: :number_of_processors, with: :threads)
11
12
  <% end -%>
12
13
 
13
14
  <% unless options[:skip_active_record] -%>
14
- # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
15
- fixtures :all
15
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
16
+ fixtures :all
16
17
 
17
18
  <% end -%>
18
- # Add more helper methods to be used by all tests here...
19
+ # Add more helper methods to be used by all tests here...
20
+ end
19
21
  end
@@ -4,6 +4,10 @@ module Rails
4
4
  module Generators
5
5
  class ApplicationRecordGenerator < Base # :nodoc:
6
6
  hook_for :orm, required: true, desc: "ORM to be invoked"
7
+
8
+ class << self
9
+ delegate(:desc, to: :orm_generator)
10
+ end
7
11
  end
8
12
  end
9
13
  end