letter_opener_web 1.4.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/brakeman-analysis.yml +46 -0
  3. data/.github/workflows/main.yml +34 -0
  4. data/.github/workflows/release-gem.yml +32 -0
  5. data/.rspec +1 -1
  6. data/.rubocop.yml +4 -13
  7. data/.rubocop_todo.yml +19 -0
  8. data/CHANGELOG.md +13 -0
  9. data/LICENSE.txt +1 -1
  10. data/README.md +29 -20
  11. data/app/controllers/letter_opener_web/application_controller.rb +1 -0
  12. data/app/controllers/letter_opener_web/letters_controller.rb +7 -4
  13. data/app/models/letter_opener_web/letter.rb +22 -1
  14. data/app/views/layouts/letter_opener_web/_javascripts.html.erb +26 -559
  15. data/app/views/layouts/letter_opener_web/_styles.html.erb +3 -63
  16. data/app/views/layouts/letter_opener_web/js/_favcount.html.erb +104 -0
  17. data/app/views/layouts/letter_opener_web/js/_jquery.html.erb +7 -0
  18. data/app/views/layouts/letter_opener_web/letters.html.erb +4 -3
  19. data/app/views/layouts/letter_opener_web/styles/_bootstrap.html.erb +9 -0
  20. data/app/views/layouts/letter_opener_web/styles/_icon.html.erb +2 -0
  21. data/app/views/layouts/letter_opener_web/styles/_letters.html.erb +70 -0
  22. data/app/views/letter_opener_web/letters/_item.html.erb +10 -0
  23. data/app/views/letter_opener_web/letters/index.html.erb +11 -46
  24. data/config/routes.rb +5 -5
  25. data/letter_opener_web.gemspec +11 -8
  26. data/lib/letter_opener_web/version.rb +1 -1
  27. data/lib/letter_opener_web.rb +1 -0
  28. data/spec/controllers/letter_opener_web/letters_controller_spec.rb +4 -4
  29. data/spec/dummy/app/assets/config/manifest.js +0 -2
  30. data/spec/dummy/app/assets/stylesheets/application.css +0 -16
  31. data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
  32. data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
  33. data/spec/dummy/app/controllers/application_controller.rb +0 -1
  34. data/spec/dummy/app/{assets/javascripts → javascript/packs}/application.js +2 -0
  35. data/spec/dummy/app/jobs/application_job.rb +9 -0
  36. data/spec/dummy/app/models/application_record.rb +5 -0
  37. data/spec/dummy/app/models/concerns/.keep +0 -0
  38. data/spec/dummy/app/views/layouts/application.html.erb +4 -7
  39. data/spec/dummy/bin/rails +2 -4
  40. data/spec/dummy/bin/rake +2 -4
  41. data/spec/dummy/bin/setup +7 -10
  42. data/spec/dummy/config/application.rb +21 -7
  43. data/spec/dummy/config/environments/development.rb +44 -6
  44. data/spec/dummy/config/environments/production.rb +51 -14
  45. data/spec/dummy/config/environments/test.rb +30 -6
  46. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -4
  47. data/spec/dummy/config/initializers/assets.rb +5 -5
  48. data/spec/dummy/config/initializers/backtrace_silencers.rb +5 -3
  49. data/spec/dummy/config/initializers/content_security_policy.rb +29 -0
  50. data/spec/dummy/config/initializers/filter_parameter_logging.rb +3 -1
  51. data/spec/dummy/config/initializers/permissions_policy.rb +12 -0
  52. data/spec/dummy/config/locales/en.yml +11 -1
  53. data/spec/dummy/config/puma.rb +18 -22
  54. data/spec/dummy/config/routes.rb +1 -4
  55. data/spec/dummy/config.ru +1 -0
  56. data/spec/dummy/public/404.html +6 -6
  57. data/spec/dummy/public/422.html +6 -6
  58. data/spec/dummy/public/500.html +6 -6
  59. data/spec/dummy/storage/.keep +0 -0
  60. data/spec/letter_opener_web_spec.rb +2 -2
  61. data/spec/models/letter_opener_web/letter_spec.rb +48 -14
  62. metadata +87 -42
  63. data/.travis.yml +0 -23
  64. data/spec/dummy/app/controllers/home_controller.rb +0 -10
  65. data/spec/dummy/app/mailers/contact_mailer.rb +0 -14
  66. data/spec/dummy/app/views/contact_mailer/new_message.html.erb +0 -21
  67. data/spec/dummy/app/views/contact_mailer/new_message.text.erb +0 -3
  68. data/spec/dummy/app/views/home/index.html.erb +0 -50
  69. data/spec/dummy/bin/bundle +0 -5
  70. data/spec/dummy/bin/update +0 -31
  71. data/spec/dummy/config/initializers/new_framework_defaults.rb +0 -10
  72. data/spec/dummy/config/initializers/session_store.rb +0 -5
  73. data/spec/dummy/config/secrets.yml +0 -22
  74. data/spec/dummy/config/spring.rb +0 -8
@@ -13,19 +13,22 @@ Gem::Specification.new do |gem|
13
13
  gem.summary = gem.description
14
14
  gem.homepage = 'https://github.com/fgrehm/letter_opener_web'
15
15
  gem.license = 'MIT'
16
- gem.required_ruby_version = '>= 2.5'
16
+ gem.required_ruby_version = '>= 2.7'
17
17
 
18
18
  gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
19
19
  gem.executables = gem.files.grep(%r{^exe/}).map { |f| File.basename(f) }
20
20
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
21
  gem.require_paths = ['lib']
22
22
 
23
- gem.add_dependency 'actionmailer', '>= 3.2'
24
- gem.add_dependency 'letter_opener', '~> 1.0'
25
- gem.add_dependency 'railties', '>= 3.2'
23
+ gem.add_dependency 'actionmailer', '>= 5.2'
24
+ gem.add_dependency 'letter_opener', '~> 1.7'
25
+ gem.add_dependency 'railties', '>= 5.2'
26
+ gem.add_dependency 'rexml'
26
27
 
27
- gem.add_development_dependency 'rails', '~> 5.0'
28
- gem.add_development_dependency 'rspec-rails', '~> 3.0'
29
- gem.add_development_dependency 'rubocop', '~> 0.79'
30
- gem.add_development_dependency 'shoulda-matchers', '~> 2.5'
28
+ gem.add_development_dependency 'rails', '~> 6.1'
29
+ gem.add_development_dependency 'rspec-rails', '~> 5.0'
30
+ gem.add_development_dependency 'rubocop', '~> 1.22'
31
+ gem.add_development_dependency 'rubocop-rails', '~> 2.12'
32
+ gem.add_development_dependency 'rubocop-rspec', '~> 2.5'
33
+ gem.add_development_dependency 'shoulda-matchers', '~> 5.0'
31
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LetterOpenerWeb
4
- VERSION = '1.4.1'
4
+ VERSION = '2.0.0'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'letter_opener_web/version'
3
4
  require 'letter_opener_web/engine'
4
5
  require 'rexml/document'
5
6
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'rails_helper'
4
4
 
5
- describe LetterOpenerWeb::LettersController do
5
+ RSpec.describe LetterOpenerWeb::LettersController do
6
6
  routes { LetterOpenerWeb::Engine.routes }
7
7
 
8
8
  after(:each) { LetterOpenerWeb.reset! }
@@ -19,7 +19,7 @@ describe LetterOpenerWeb::LettersController do
19
19
 
20
20
  it 'returns an HTML 200 response' do
21
21
  expect(response.status).to eq(200)
22
- expect(response.content_type).to eq('text/html')
22
+ expect(response.content_type).to eq('text/html; charset=utf-8')
23
23
  end
24
24
  end
25
25
 
@@ -38,7 +38,7 @@ describe LetterOpenerWeb::LettersController do
38
38
 
39
39
  it 'renders an HTML 200 response' do
40
40
  expect(response.status).to eq(200)
41
- expect(response.content_type).to eq('text/html')
41
+ expect(response.content_type).to eq('text/html; charset=utf-8')
42
42
  end
43
43
  end
44
44
 
@@ -89,7 +89,7 @@ describe LetterOpenerWeb::LettersController do
89
89
 
90
90
  it 'sends the file as an inline attachment' do
91
91
  allow(controller).to receive(:send_file) { controller.head :ok }
92
- get :attachment, params: { id: id, file: file_name.gsub(/\.\w+/, ''), format: File.extname(file_name)[1..-1] }
92
+ get :attachment, params: { id: id, file: file_name.gsub(/\.\w+/, ''), format: File.extname(file_name)[1..] }
93
93
 
94
94
  expect(response.status).to eq(200)
95
95
  expect(controller).to have_received(:send_file)
@@ -1,5 +1,3 @@
1
-
2
1
  //= link_tree ../images
3
- //= link_directory ../javascripts .js
4
2
  //= link_directory ../stylesheets .css
5
3
  //= link letter_opener_web_manifest.js
@@ -13,19 +13,3 @@
13
13
  *= require_tree .
14
14
  *= require_self
15
15
  */
16
-
17
- body {
18
- padding-top: 20px;
19
- }
20
-
21
- .alert {
22
- margin-top: 20px;
23
- }
24
-
25
- h1, .footer {
26
- text-align: center;
27
- }
28
-
29
- .icon-white {
30
- background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings-white.png"%>);
31
- }
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Channel < ActionCable::Channel::Base
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationCable
4
+ class Connection < ActionCable::Connection::Base
5
+ end
6
+ end
@@ -1,5 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ApplicationController < ActionController::Base
4
- protect_from_forgery with: :exception
5
4
  end
@@ -10,4 +10,6 @@
10
10
  // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require rails-ujs
14
+ //= require activestorage
13
15
  //= require_tree .
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ # Automatically retry jobs that encountered a deadlock
5
+ # retry_on ActiveRecord::Deadlocked
6
+
7
+ # Most jobs are safe to ignore if the underlying records are no longer available
8
+ # discard_on ActiveJob::DeserializationError
9
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
File without changes
@@ -2,17 +2,14 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>Dummy</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
5
6
  <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
6
8
 
7
- <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
- <%= stylesheet_link_tag '//maxcdn.bootstrapcdn.com/bootstrap/2.3.2/css/bootstrap.min.css' %>
9
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
10
  </head>
10
11
 
11
12
  <body>
12
- <div class="container">
13
- <%= yield %>
14
- </div>
15
-
16
- <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
13
+ <%= yield %>
17
14
  </body>
18
15
  </html>
data/spec/dummy/bin/rails CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
2
  APP_PATH = File.expand_path('../config/application', __dir__)
5
- require_relative '../config/boot'
6
- require 'rails/commands'
3
+ require_relative "../config/boot"
4
+ require "rails/commands"
data/spec/dummy/bin/rake CHANGED
@@ -1,6 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require_relative '../config/boot'
5
- require 'rake'
2
+ require_relative "../config/boot"
3
+ require "rake"
6
4
  Rake.application.run
data/spec/dummy/bin/setup CHANGED
@@ -1,19 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'pathname'
5
- require 'fileutils'
6
- include FileUtils
2
+ require "fileutils"
7
3
 
8
4
  # path to your application root.
9
- APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
5
+ APP_ROOT = File.expand_path('..', __dir__)
10
6
 
11
7
  def system!(*args)
12
8
  system(*args) || abort("\n== Command #{args} failed ==")
13
9
  end
14
10
 
15
- chdir APP_ROOT do
16
- # This script is a starting point to setup your application.
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to set up or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
17
14
  # Add necessary setup steps to this file.
18
15
 
19
16
  puts '== Installing dependencies =='
@@ -22,11 +19,11 @@ chdir APP_ROOT do
22
19
 
23
20
  # puts "\n== Copying sample files =="
24
21
  # unless File.exist?('config/database.yml')
25
- # cp 'config/database.yml.sample', 'config/database.yml'
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
26
23
  # end
27
24
 
28
25
  puts "\n== Preparing database =="
29
- system! 'bin/rails db:setup'
26
+ system! 'bin/rails db:prepare'
30
27
 
31
28
  puts "\n== Removing old logs and tempfiles =="
32
29
  system! 'bin/rails log:clear tmp:clear'
@@ -2,22 +2,36 @@
2
2
 
3
3
  require_relative 'boot'
4
4
 
5
- require 'active_model/railtie'
5
+ require 'rails'
6
+ # Pick the frameworks you want:
7
+ # require "active_model/railtie"
8
+ # require "active_job/railtie"
9
+ # require "active_record/railtie"
10
+ # require "active_storage/engine"
6
11
  require 'action_controller/railtie'
7
12
  require 'action_mailer/railtie'
13
+ # require "action_mailbox/engine"
14
+ # require "action_text/engine"
8
15
  require 'action_view/railtie'
9
- require 'sprockets/railtie'
10
- require 'rails/test_unit/railtie'
16
+ # require "action_cable/engine"
17
+ # require "sprockets/railtie"
18
+ # require "rails/test_unit/railtie"
11
19
 
20
+ # Require the gems listed in Gemfile, including any gems
21
+ # you've limited to :test, :development, or :production.
12
22
  Bundler.require(*Rails.groups)
13
23
  require 'letter_opener_web'
14
24
 
15
25
  module Dummy
16
26
  class Application < Rails::Application
17
- # Settings in config/environments/* take precedence over those specified here.
18
- # Application configuration should go into files in config/initializers
19
- # -- all .rb files in that directory are automatically loaded.
27
+ config.load_defaults Rails::VERSION::STRING.to_f
20
28
 
21
- config.action_mailer.delivery_method = :letter_opener_web
29
+ # Configuration for the application, engines, and railties goes here.
30
+ #
31
+ # These settings can be overridden in specific environments using the files
32
+ # in config/environments, which are processed later.
33
+ #
34
+ # config.time_zone = "Central Time (US & Canada)"
35
+ # config.eager_load_paths << Rails.root.join("extras")
22
36
  end
23
37
  end
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/integer/time'
4
+
3
5
  Rails.application.configure do
4
6
  # Settings specified here will take precedence over those in config/application.rb.
5
7
 
6
- # In the development environment your application's code is reloaded on
7
- # every request. This slows down response time but is perfect for development
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
8
10
  # since you don't have to restart the web server when you make code changes.
9
11
  config.cache_classes = false
10
12
 
@@ -14,15 +16,45 @@ Rails.application.configure do
14
16
  # Show full error reports.
15
17
  config.consider_all_requests_local = true
16
18
 
17
- config.action_controller.perform_caching = false
18
- config.cache_store = :null_store
19
+ # Enable/disable caching. By default caching is disabled.
20
+ # Run rails dev:cache to toggle caching.
21
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
22
+ config.action_controller.perform_caching = true
23
+ config.action_controller.enable_fragment_cache_logging = true
24
+
25
+ config.cache_store = :memory_store
26
+ config.public_file_server.headers = {
27
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
28
+ }
29
+ else
30
+ config.action_controller.perform_caching = false
31
+
32
+ config.cache_store = :null_store
33
+ end
34
+
35
+ # Store uploaded files on the local file system (see config/storage.yml for options).
36
+ # config.active_storage.service = :local
19
37
 
20
38
  # Don't care if the mailer can't send.
21
39
  config.action_mailer.raise_delivery_errors = false
22
40
 
41
+ config.action_mailer.perform_caching = false
42
+
23
43
  # Print deprecation notices to the Rails logger.
24
44
  config.active_support.deprecation = :log
25
45
 
46
+ # Raise exceptions for disallowed deprecations.
47
+ config.active_support.disallowed_deprecation = :raise
48
+
49
+ # Tell Active Support which deprecation messages to disallow.
50
+ config.active_support.disallowed_deprecation_warnings = []
51
+
52
+ # Raise an error on page load if there are pending migrations.
53
+ # config.active_record.migration_error = :page_load
54
+
55
+ # Highlight code that triggered database queries in logs.
56
+ # config.active_record.verbose_query_logs = true
57
+
26
58
  # Debug mode disables concatenation and preprocessing of assets.
27
59
  # This option may cause significant delays in view rendering with a large
28
60
  # number of complex assets.
@@ -31,10 +63,16 @@ Rails.application.configure do
31
63
  # Suppress logger output for asset requests.
32
64
  config.assets.quiet = true
33
65
 
34
- # Raises error for missing translations
35
- # config.action_view.raise_on_missing_translations = true
66
+ # Raises error for missing translations.
67
+ # config.i18n.raise_on_missing_translations = true
68
+
69
+ # Annotate rendered view with file names.
70
+ # config.action_view.annotate_rendered_view_with_filenames = true
36
71
 
37
72
  # Use an evented file watcher to asynchronously detect changes in source code,
38
73
  # routes, locales, etc. This feature depends on the listen gem.
39
74
  # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
75
+
76
+ # Uncomment if you wish to allow Action Cable access from any origin.
77
+ # config.action_cable.disable_request_forgery_protection = true
40
78
  end
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/integer/time'
4
+
3
5
  Rails.application.configure do
4
6
  # Settings specified here will take precedence over those in config/application.rb.
5
7
 
@@ -16,27 +18,31 @@ Rails.application.configure do
16
18
  config.consider_all_requests_local = false
17
19
  config.action_controller.perform_caching = true
18
20
 
21
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
19
25
  # Disable serving static files from the `/public` folder by default since
20
26
  # Apache or NGINX already handles this.
21
27
  config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
22
28
 
23
- # Compress JavaScripts and CSS.
24
- config.assets.js_compressor = :uglifier
29
+ # Compress CSS using a preprocessor.
25
30
  # config.assets.css_compressor = :sass
26
31
 
27
32
  # Do not fallback to assets pipeline if a precompiled asset is missed.
28
33
  config.assets.compile = false
29
34
 
30
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
31
-
32
35
  # Enable serving of images, stylesheets, and JavaScripts from an asset server.
33
- # config.action_controller.asset_host = 'http://assets.example.com'
36
+ # config.asset_host = 'http://assets.example.com'
34
37
 
35
38
  # Specifies the header that your server uses for sending files.
36
39
  # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
37
40
  # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
38
41
 
39
- # Mount Action Cable outside main process or domain
42
+ # Store uploaded files on the local file system (see config/storage.yml for options).
43
+ # config.active_storage.service = :local
44
+
45
+ # Mount Action Cable outside main process or domain.
40
46
  # config.action_cable.mount_path = nil
41
47
  # config.action_cable.url = 'wss://example.com/cable'
42
48
  # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
@@ -44,9 +50,9 @@ Rails.application.configure do
44
50
  # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
45
51
  # config.force_ssl = true
46
52
 
47
- # Use the lowest log level to ensure availability of diagnostic information
48
- # when problems arise.
49
- config.log_level = :debug
53
+ # Include generic and useful information about system operation, but avoid logging too much
54
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
55
+ config.log_level = :info
50
56
 
51
57
  # Prepend all log lines with the following tags.
52
58
  config.log_tags = [:request_id]
@@ -54,9 +60,10 @@ Rails.application.configure do
54
60
  # Use a different cache store in production.
55
61
  # config.cache_store = :mem_cache_store
56
62
 
57
- # Use a real queuing backend for Active Job (and separate queues per environment)
63
+ # Use a real queuing backend for Active Job (and separate queues per environment).
58
64
  # config.active_job.queue_adapter = :resque
59
- # config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
65
+ # config.active_job.queue_name_prefix = "dummy_production"
66
+
60
67
  config.action_mailer.perform_caching = false
61
68
 
62
69
  # Ignore bad email addresses and do not raise email delivery errors.
@@ -70,16 +77,46 @@ Rails.application.configure do
70
77
  # Send deprecation notices to registered listeners.
71
78
  config.active_support.deprecation = :notify
72
79
 
80
+ # Log disallowed deprecations.
81
+ config.active_support.disallowed_deprecation = :log
82
+
83
+ # Tell Active Support which deprecation messages to disallow.
84
+ config.active_support.disallowed_deprecation_warnings = []
85
+
73
86
  # Use default logging formatter so that PID and timestamp are not suppressed.
74
87
  config.log_formatter = ::Logger::Formatter.new
75
88
 
76
89
  # Use a different logger for distributed setups.
77
- # require 'syslog/logger'
90
+ # require "syslog/logger"
78
91
  # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
79
92
 
80
93
  if ENV['RAILS_LOG_TO_STDOUT'].present?
81
- logger = ActiveSupport::Logger.new(STDOUT)
94
+ logger = ActiveSupport::Logger.new($stdout)
82
95
  logger.formatter = config.log_formatter
83
- config.logger = ActiveSupport::TaggedLogging.new(logger)
96
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
84
97
  end
98
+
99
+ # Do not dump schema after migrations.
100
+ # config.active_record.dump_schema_after_migration = false
101
+
102
+ # Inserts middleware to perform automatic connection switching.
103
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
104
+ # middleware. The `delay` is used to determine how long to wait after a write
105
+ # to send a subsequent read to the primary.
106
+ #
107
+ # The `database_resolver` class is used by the middleware to determine which
108
+ # database is appropriate to use based on the time delay.
109
+ #
110
+ # The `database_resolver_context` class is used by the middleware to set
111
+ # timestamps for the last write to the primary. The resolver uses the context
112
+ # class timestamps to determine how long to wait before reading from the
113
+ # replica.
114
+ #
115
+ # By default Rails will store a last write timestamp in the session. The
116
+ # DatabaseSelector middleware is designed as such you can define your own
117
+ # strategy for connection switching and pass that into the middleware through
118
+ # these configuration options.
119
+ # config.active_record.database_selector = { delay: 2.seconds }
120
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
121
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
85
122
  end
@@ -1,12 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+
3
10
  Rails.application.configure do
4
11
  # Settings specified here will take precedence over those in config/application.rb.
5
12
 
6
- # The test environment is used exclusively to run your application's
7
- # test suite. You never need to work with it otherwise. Remember that
8
- # your test database is "scratch space" for the test suite and is wiped
9
- # and recreated between test runs. Don't rely on the data there!
10
13
  config.cache_classes = true
11
14
 
12
15
  # Do not eager load code on boot. This avoids loading your whole application
@@ -14,9 +17,16 @@ Rails.application.configure do
14
17
  # preloads Rails for running tests, you may have to set it to true.
15
18
  config.eager_load = false
16
19
 
20
+ # Configure public file server for tests with Cache-Control for performance.
21
+ config.public_file_server.enabled = true
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
24
+ }
25
+
17
26
  # Show full error reports and disable caching.
18
27
  config.consider_all_requests_local = true
19
28
  config.action_controller.perform_caching = false
29
+ config.cache_store = :null_store
20
30
 
21
31
  # Raise exceptions instead of rendering exception templates.
22
32
  config.action_dispatch.show_exceptions = false
@@ -24,6 +34,11 @@ Rails.application.configure do
24
34
  # Disable request forgery protection in test environment.
25
35
  config.action_controller.allow_forgery_protection = false
26
36
 
37
+ # Store uploaded files on the local file system in a temporary directory.
38
+ # config.active_storage.service = :test
39
+
40
+ config.action_mailer.perform_caching = false
41
+
27
42
  # Tell Action Mailer not to deliver emails to the real world.
28
43
  # The :test delivery method accumulates sent emails in the
29
44
  # ActionMailer::Base.deliveries array.
@@ -32,6 +47,15 @@ Rails.application.configure do
32
47
  # Print deprecation notices to the stderr.
33
48
  config.active_support.deprecation = :stderr
34
49
 
35
- # Raises error for missing translations
36
- # config.action_view.raise_on_missing_translations = true
50
+ # Raise exceptions for disallowed deprecations.
51
+ config.active_support.disallowed_deprecation = :raise
52
+
53
+ # Tell Active Support which deprecation messages to disallow.
54
+ config.active_support.disallowed_deprecation_warnings = []
55
+
56
+ # Raises error for missing translations.
57
+ # config.i18n.raise_on_missing_translations = true
58
+
59
+ # Annotate rendered view with file names.
60
+ # config.action_view.annotate_rendered_view_with_filenames = true
37
61
  end
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  # Be sure to restart your server when you modify this file.
3
3
 
4
- # ApplicationController.renderer.defaults.merge!(
5
- # http_host: 'example.org',
6
- # https: false
7
- # )
4
+ # ActiveSupport::Reloader.to_prepare do
5
+ # ApplicationController.renderer.defaults.merge!(
6
+ # http_host: 'example.org',
7
+ # https: false
8
+ # )
9
+ # end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
-
3
2
  # Be sure to restart your server when you modify this file.
4
3
 
5
4
  # Version of your assets, change this if you want to expire all your assets.
6
- Rails.application.config.assets.version = '1.0'
5
+ # Rails.application.config.assets.version = '1.0'
7
6
 
8
- # Add additional assets to the asset load path
7
+ # Add additional assets to the asset load path.
9
8
  # Rails.application.config.assets.paths << Emoji.images_path
10
9
 
11
10
  # Precompile additional assets.
12
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
13
- # Rails.application.config.assets.precompile += %w( search.js )
11
+ # application.js, application.css, and all non-JS/CSS in the app/assets
12
+ # folder are already added.
13
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  # Be sure to restart your server when you modify this file.
3
4
 
4
5
  # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
5
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
6
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
6
7
 
7
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
8
- # Rails.backtrace_cleaner.remove_silencers!
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10
+ Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE']
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Define an application-wide content security policy
5
+ # For further information see the following documentation
6
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7
+
8
+ # Rails.application.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
+
16
+ # # Specify URI for violation reports
17
+ # # policy.report_uri "/csp-violation-report-endpoint"
18
+ # end
19
+
20
+ # If you are using UJS then enable automatic nonce generation
21
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
22
+
23
+ # Set the nonce only to specific directives
24
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
25
+
26
+ # Report CSP violations to a specified URI
27
+ # For further information see the following documentation:
28
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
29
+ # Rails.application.config.content_security_policy_report_only = true
@@ -3,4 +3,6 @@
3
3
  # Be sure to restart your server when you modify this file.
4
4
 
5
5
  # Configure sensitive parameters which will be filtered from the log file.
6
- Rails.application.config.filter_parameters += [:password]
6
+ Rails.application.config.filter_parameters += %i[
7
+ passw secret token _key crypt salt certificate otp ssn
8
+ ]