質問編集履歴

2

マークダウン記法編集

2020/03/20 13:22

投稿

karirin3948
karirin3948

スコア20

test CHANGED
File without changes
test CHANGED
@@ -514,7 +514,7 @@
514
514
 
515
515
  end
516
516
 
517
-
517
+ ```
518
518
 
519
519
  他にも確認するべきソースコードがございましたらご連絡をお願いいたします。
520
520
 

1

config/environments/test.rb追記

2020/03/20 13:22

投稿

karirin3948
karirin3948

スコア20

test CHANGED
File without changes
test CHANGED
@@ -46,85 +46,443 @@
46
46
 
47
47
  Rails.application.configure do
48
48
 
49
+
50
+
51
+ config.cache_classes = false
52
+
53
+
54
+
55
+ # Do not eager load code on boot.
56
+
57
+ config.eager_load = false
58
+
59
+
60
+
61
+ # Show full error reports.
62
+
63
+ config.consider_all_requests_local = true
64
+
65
+
66
+
67
+ # Enable/disable caching. By default caching is disabled.
68
+
69
+ # Run rails dev:cache to toggle caching.
70
+
71
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
72
+
73
+ config.action_controller.perform_caching = true
74
+
75
+ config.action_controller.enable_fragment_cache_logging = true
76
+
77
+
78
+
79
+ config.cache_store = :memory_store
80
+
81
+ config.public_file_server.headers = {
82
+
83
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
84
+
85
+ }
86
+
87
+ else
88
+
89
+ config.action_controller.perform_caching = false
90
+
91
+
92
+
93
+ config.cache_store = :null_store
94
+
95
+ end
96
+
97
+
98
+
99
+ # Store uploaded files on the local file system (see config/storage.yml for options).
100
+
101
+ # config.active_storage.service = :local
102
+
103
+
104
+
105
+ # Don't care if the mailer can't send.
106
+
107
+ config.action_mailer.raise_delivery_errors = false
108
+
109
+
110
+
111
+ host = 'rails-tutorial-mhartl.c9users.io'
112
+
113
+
114
+
115
+ config.action_mailer.default_url_options = { host: host, protocol: 'https' }
116
+
117
+
118
+
119
+ # config.action_mailer.default_url_options = { host: host, protocol: 'http' }
120
+
121
+
122
+
123
+ config.action_mailer.perform_caching = false
124
+
125
+
126
+
127
+ # Print deprecation notices to the Rails logger.
128
+
129
+ config.active_support.deprecation = :log
130
+
131
+
132
+
133
+ # Raise an error on page load if there are pending migrations.
134
+
135
+ config.active_record.migration_error = :page_load
136
+
137
+
138
+
139
+ # Highlight code that triggered database queries in logs.
140
+
141
+ config.active_record.verbose_query_logs = true
142
+
143
+
144
+
145
+ # Debug mode disables concatenation and preprocessing of assets.
146
+
147
+ # This option may cause significant delays in view rendering with a large
148
+
149
+ # number of complex assets.
150
+
151
+ config.assets.debug = true
152
+
153
+
154
+
155
+ # Suppress logger output for asset requests.
156
+
157
+ config.assets.quiet = true
158
+
159
+
160
+
161
+ # Raises error for missing translations.
162
+
163
+ # config.action_view.raise_on_missing_translations = true
164
+
165
+
166
+
167
+ # Use an evented file watcher to asynchronously detect changes in source code,
168
+
169
+ # routes, locales, etc. This feature depends on the listen gem.
170
+
171
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker
172
+
173
+
174
+
175
+
176
+
177
+ config.hosts.clear
178
+
179
+ end
180
+
181
+ ```
182
+
183
+ ###config/environments/production.rb
184
+
185
+ ```
186
+
187
+ Rails.application.configure do
188
+
189
+ config.cache_classes = true
190
+
191
+
192
+
193
+ config.eager_load = true
194
+
195
+
196
+
197
+ # Full error reports are disabled and caching is turned on.
198
+
199
+ config.consider_all_requests_local = false
200
+
201
+ config.action_controller.perform_caching = true
202
+
203
+
204
+
205
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
206
+
207
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
208
+
209
+ # config.require_master_key = true
210
+
211
+
212
+
213
+ # Disable serving static files from the `/public` folder by default since
214
+
215
+ # Apache or NGINX already handles this.
216
+
217
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
218
+
219
+
220
+
221
+ # Compress CSS using a preprocessor.
222
+
223
+ # config.assets.css_compressor = :sass
224
+
225
+
226
+
227
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
228
+
229
+ config.assets.compile = false
230
+
231
+
232
+
233
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
234
+
235
+ # config.action_controller.asset_host = 'http://assets.example.com'
236
+
237
+
238
+
239
+ # Specifies the header that your server uses for sending files.
240
+
241
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
242
+
243
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
244
+
245
+
246
+
247
+ # Store uploaded files on the local file system (see config/storage.yml for options).
248
+
249
+ # config.active_storage.service = :local
250
+
251
+
252
+
253
+ # Mount Action Cable outside main process or domain.
254
+
255
+ # config.action_cable.mount_path = nil
256
+
257
+ # config.action_cable.url = 'wss://example.com/cable'
258
+
259
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ]
260
+
261
+
262
+
263
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
264
+
265
+ config.force_ssl = true
266
+
267
+
268
+
269
+ # Use the lowest log level to ensure availability of diagnostic information
270
+
271
+ # when problems arise.
272
+
273
+ config.log_level = :debug
274
+
275
+
276
+
277
+ # Prepend all log lines with the following tags.
278
+
279
+ config.log_tags = [ :request_id ]
280
+
281
+
282
+
283
+ # Use a different cache store in production.
284
+
285
+ # config.cache_store = :mem_cache_store
286
+
287
+
288
+
289
+ # Use a real queuing backend for Active Job (and separate queues per environment).
290
+
291
+ # config.active_job.queue_adapter = :resque
292
+
293
+ # config.active_job.queue_name_prefix = "sample_app_production"
294
+
295
+
296
+
297
+ config.action_mailer.perform_caching = false
298
+
299
+
300
+
301
+ # Ignore bad email addresses and do not raise email delivery errors.
302
+
303
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
304
+
305
+ config.action_mailer.raise_delivery_errors = true
306
+
307
+ config.action_mailer.delivery_method = :smtp
308
+
309
+ host = '<your heroku app>.herokuapp.com'
310
+
311
+ config.action_mailer.default_url_options = { host: host }
312
+
313
+ ActionMailer::Base.smtp_settings = {
314
+
315
+ :address => 'smtp.sendgrid.net',
316
+
317
+ :port => '587',
318
+
319
+ :authentication => :plain,
320
+
321
+ :user_name => ENV['SENDGRID_USERNAME'],
322
+
323
+ :password => ENV['SENDGRID_PASSWORD'],
324
+
325
+ :domain => 'heroku.com',
326
+
327
+ :enable_starttls_auto => true
328
+
329
+ }
330
+
331
+
332
+
333
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
334
+
335
+ # the I18n.default_locale when a translation cannot be found).
336
+
337
+ config.i18n.fallbacks = true
338
+
339
+
340
+
341
+ # Send deprecation notices to registered listeners.
342
+
343
+ config.active_support.deprecation = :notify
344
+
345
+
346
+
347
+ # Use default logging formatter so that PID and timestamp are not suppressed.
348
+
349
+ config.log_formatter = ::Logger::Formatter.new
350
+
351
+
352
+
353
+ # Use a different logger for distributed setups.
354
+
355
+ # require 'syslog/logger'
356
+
357
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
358
+
359
+
360
+
361
+ if ENV["RAILS_LOG_TO_STDOUT"].present?
362
+
363
+ logger = ActiveSupport::Logger.new(STDOUT)
364
+
365
+ logger.formatter = config.log_formatter
366
+
367
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
368
+
369
+ end
370
+
371
+
372
+
373
+ # Do not dump schema after migrations.
374
+
375
+ config.active_record.dump_schema_after_migration = false
376
+
377
+
378
+
379
+ # Inserts middleware to perform automatic connection switching.
380
+
381
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
382
+
383
+ # middleware. The `delay` is used to determine how long to wait after a write
384
+
385
+ # to send a subsequent read to the primary.
386
+
387
+ #
388
+
389
+ # The `database_resolver` class is used by the middleware to determine which
390
+
391
+ # database is appropriate to use based on the time delay.
392
+
393
+ #
394
+
395
+ # The `database_resolver_context` class is used by the middleware to set
396
+
397
+ # timestamps for the last write to the primary. The resolver uses the context
398
+
399
+ # class timestamps to determine how long to wait before reading from the
400
+
401
+ # replica.
402
+
403
+ #
404
+
405
+ # By default Rails will store a last write timestamp in the session. The
406
+
407
+ # DatabaseSelector middleware is designed as such you can define your own
408
+
409
+ # strategy for connection switching and pass that into the middleware through
410
+
411
+ # these configuration options.
412
+
413
+ # config.active_record.database_selector = { delay: 2.seconds }
414
+
415
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
416
+
417
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
418
+
419
+ end
420
+
421
+ ```
422
+
423
+ ###config/environments/test.rb
424
+
425
+
426
+
427
+ ```
428
+
429
+ Rails.application.configure do
430
+
49
431
  # Settings specified here will take precedence over those in config/application.rb.
50
432
 
51
433
 
52
434
 
53
- # In the development environment your application's code is reloaded on
54
-
55
- # every request. This slows down response time but is perfect for development
56
-
57
- # since you don't have to restart the web server when you make code changes.
58
-
59
435
  config.cache_classes = false
60
436
 
61
437
 
62
438
 
63
- # Do not eager load code on boot.
439
+ # Do not eager load code on boot. This avoids loading your whole application
440
+
441
+ # just for the purpose of running a single test. If you are using a tool that
442
+
443
+ # preloads Rails for running tests, you may have to set it to true.
64
444
 
65
445
  config.eager_load = false
66
446
 
67
447
 
68
448
 
69
- # Show full error reports.
449
+ # Configure public file server for tests with Cache-Control for performance.
70
-
450
+
71
- config.consider_all_requests_local = true
451
+ config.public_file_server.enabled = true
72
-
73
-
74
-
75
- # Enable/disable caching. By default caching is disabled.
452
+
76
-
77
- # Run rails dev:cache to toggle caching.
78
-
79
- if Rails.root.join('tmp', 'caching-dev.txt').exist?
80
-
81
- config.action_controller.perform_caching = true
82
-
83
- config.action_controller.enable_fragment_cache_logging = true
84
-
85
-
86
-
87
- config.cache_store = :memory_store
88
-
89
- config.public_file_server.headers = {
453
+ config.public_file_server.headers = {
90
-
454
+
91
- 'Cache-Control' => "public, max-age=#{2.days.to_i}"
455
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
92
-
456
+
93
- }
457
+ }
458
+
459
+
460
+
94
-
461
+ # Show full error reports and disable caching.
462
+
95
- else
463
+ config.consider_all_requests_local = true
96
-
464
+
97
- config.action_controller.perform_caching = false
465
+ config.action_controller.perform_caching = false
98
-
99
-
100
-
466
+
101
- config.cache_store = :null_store
467
+ config.cache_store = :null_store
468
+
469
+
470
+
102
-
471
+ # Raise exceptions instead of rendering exception templates.
472
+
103
- end
473
+ config.action_dispatch.show_exceptions = false
474
+
475
+
476
+
104
-
477
+ # Disable request forgery protection in test environment.
478
+
105
-
479
+ config.action_controller.allow_forgery_protection = false
106
-
480
+
481
+
482
+
107
- # Store uploaded files on the local file system (see config/storage.yml for options).
483
+ # Store uploaded files on the local file system in a temporary directory.
108
-
484
+
109
- # config.active_storage.service = :local
485
+ # config.active_storage.service = :test
110
-
111
-
112
-
113
- # Don't care if the mailer can't send.
114
-
115
- config.action_mailer.raise_delivery_errors = false
116
-
117
-
118
-
119
- host = 'rails-tutorial-mhartl.c9users.io'
120
-
121
-
122
-
123
- config.action_mailer.default_url_options = { host: host, protocol: 'https' }
124
-
125
-
126
-
127
- # config.action_mailer.default_url_options = { host: host, protocol: 'http' }
128
486
 
129
487
 
130
488
 
@@ -132,37 +490,21 @@
132
490
 
133
491
 
134
492
 
493
+ # Tell Action Mailer not to deliver emails to the real world.
494
+
495
+ # The :test delivery method accumulates sent emails in the
496
+
497
+ # ActionMailer::Base.deliveries array.
498
+
499
+ config.action_mailer.delivery_method = :test
500
+
501
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
502
+
503
+
504
+
135
- # Print deprecation notices to the Rails logger.
505
+ # Print deprecation notices to the stderr.
136
-
506
+
137
- config.active_support.deprecation = :log
507
+ config.active_support.deprecation = :stderr
138
-
139
-
140
-
141
- # Raise an error on page load if there are pending migrations.
142
-
143
- config.active_record.migration_error = :page_load
144
-
145
-
146
-
147
- # Highlight code that triggered database queries in logs.
148
-
149
- config.active_record.verbose_query_logs = true
150
-
151
-
152
-
153
- # Debug mode disables concatenation and preprocessing of assets.
154
-
155
- # This option may cause significant delays in view rendering with a large
156
-
157
- # number of complex assets.
158
-
159
- config.assets.debug = true
160
-
161
-
162
-
163
- # Suppress logger output for asset requests.
164
-
165
- config.assets.quiet = true
166
508
 
167
509
 
168
510
 
@@ -170,280 +512,8 @@
170
512
 
171
513
  # config.action_view.raise_on_missing_translations = true
172
514
 
173
-
174
-
175
- # Use an evented file watcher to asynchronously detect changes in source code,
176
-
177
- # routes, locales, etc. This feature depends on the listen gem.
178
-
179
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
180
-
181
-
182
-
183
-
184
-
185
- config.hosts.clear
186
-
187
515
  end
188
516
 
189
- ```
190
-
191
- ###config/environments/production.rb
192
-
193
- ```
194
-
195
- Rails.application.configure do
196
-
197
- # Settings specified here will take precedence over those in config/application.rb.
198
-
199
-
200
-
201
- # Code is not reloaded between requests.
202
-
203
- config.cache_classes = true
204
-
205
-
206
-
207
- # Eager load code on boot. This eager loads most of Rails and
208
-
209
- # your application in memory, allowing both threaded web servers
210
-
211
- # and those relying on copy on write to perform better.
212
-
213
- # Rake tasks automatically ignore this option for performance.
214
-
215
- config.eager_load = true
216
-
217
-
218
-
219
- # Full error reports are disabled and caching is turned on.
220
-
221
- config.consider_all_requests_local = false
222
-
223
- config.action_controller.perform_caching = true
224
-
225
-
226
-
227
- # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
228
-
229
- # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
230
-
231
- # config.require_master_key = true
232
-
233
-
234
-
235
- # Disable serving static files from the `/public` folder by default since
236
-
237
- # Apache or NGINX already handles this.
238
-
239
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
240
-
241
-
242
-
243
- # Compress CSS using a preprocessor.
244
-
245
- # config.assets.css_compressor = :sass
246
-
247
-
248
-
249
- # Do not fallback to assets pipeline if a precompiled asset is missed.
250
-
251
- config.assets.compile = false
252
-
253
-
254
-
255
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
256
-
257
- # config.action_controller.asset_host = 'http://assets.example.com'
258
-
259
-
260
-
261
- # Specifies the header that your server uses for sending files.
262
-
263
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
264
-
265
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
266
-
267
-
268
-
269
- # Store uploaded files on the local file system (see config/storage.yml for options).
270
-
271
- # config.active_storage.service = :local
272
-
273
-
274
-
275
- # Mount Action Cable outside main process or domain.
276
-
277
- # config.action_cable.mount_path = nil
278
-
279
- # config.action_cable.url = 'wss://example.com/cable'
280
-
281
- # config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ]
282
-
283
-
284
-
285
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
286
-
287
- config.force_ssl = true
288
-
289
-
290
-
291
- # Use the lowest log level to ensure availability of diagnostic information
292
-
293
- # when problems arise.
294
-
295
- config.log_level = :debug
296
-
297
-
298
-
299
- # Prepend all log lines with the following tags.
300
-
301
- config.log_tags = [ :request_id ]
302
-
303
-
304
-
305
- # Use a different cache store in production.
306
-
307
- # config.cache_store = :mem_cache_store
308
-
309
-
310
-
311
- # Use a real queuing backend for Active Job (and separate queues per environment).
312
-
313
- # config.active_job.queue_adapter = :resque
314
-
315
- # config.active_job.queue_name_prefix = "sample_app_production"
316
-
317
-
318
-
319
- config.action_mailer.perform_caching = false
320
-
321
-
322
-
323
- # Ignore bad email addresses and do not raise email delivery errors.
324
-
325
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
326
-
327
- config.action_mailer.raise_delivery_errors = true
328
-
329
- config.action_mailer.delivery_method = :smtp
330
-
331
- host = '<your heroku app>.herokuapp.com'
332
-
333
- config.action_mailer.default_url_options = { host: host }
334
-
335
- ActionMailer::Base.smtp_settings = {
336
-
337
- :address => 'smtp.sendgrid.net',
338
-
339
- :port => '587',
340
-
341
- :authentication => :plain,
342
-
343
- :user_name => ENV['SENDGRID_USERNAME'],
344
-
345
- :password => ENV['SENDGRID_PASSWORD'],
346
-
347
- :domain => 'heroku.com',
348
-
349
- :enable_starttls_auto => true
350
-
351
- }
352
-
353
-
354
-
355
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
356
-
357
- # the I18n.default_locale when a translation cannot be found).
358
-
359
- config.i18n.fallbacks = true
360
-
361
-
362
-
363
- # Send deprecation notices to registered listeners.
364
-
365
- config.active_support.deprecation = :notify
366
-
367
-
368
-
369
- # Use default logging formatter so that PID and timestamp are not suppressed.
370
-
371
- config.log_formatter = ::Logger::Formatter.new
372
-
373
-
374
-
375
- # Use a different logger for distributed setups.
376
-
377
- # require 'syslog/logger'
378
-
379
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
380
-
381
-
382
-
383
- if ENV["RAILS_LOG_TO_STDOUT"].present?
384
-
385
- logger = ActiveSupport::Logger.new(STDOUT)
386
-
387
- logger.formatter = config.log_formatter
388
-
389
- config.logger = ActiveSupport::TaggedLogging.new(logger)
390
-
391
- end
392
-
393
-
394
-
395
- # Do not dump schema after migrations.
396
-
397
- config.active_record.dump_schema_after_migration = false
398
-
399
-
400
-
401
- # Inserts middleware to perform automatic connection switching.
402
-
403
- # The `database_selector` hash is used to pass options to the DatabaseSelector
404
-
405
- # middleware. The `delay` is used to determine how long to wait after a write
406
-
407
- # to send a subsequent read to the primary.
408
-
409
- #
410
-
411
- # The `database_resolver` class is used by the middleware to determine which
412
-
413
- # database is appropriate to use based on the time delay.
414
-
415
- #
416
-
417
- # The `database_resolver_context` class is used by the middleware to set
418
-
419
- # timestamps for the last write to the primary. The resolver uses the context
420
-
421
- # class timestamps to determine how long to wait before reading from the
422
-
423
- # replica.
424
-
425
- #
426
-
427
- # By default Rails will store a last write timestamp in the session. The
428
-
429
- # DatabaseSelector middleware is designed as such you can define your own
430
-
431
- # strategy for connection switching and pass that into the middleware through
432
-
433
- # these configuration options.
434
-
435
- # config.active_record.database_selector = { delay: 2.seconds }
436
-
437
- # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
438
-
439
- # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
440
-
441
- end
442
-
443
- ```
444
-
445
-
446
-
447
517
 
448
518
 
449
519
  他にも確認するべきソースコードがございましたらご連絡をお願いいたします。