-
Notifications
You must be signed in to change notification settings - Fork 24
/
production_spec.rb
47 lines (37 loc) · 1.3 KB
/
production_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
describe 'config/environments/production.rb' do
subject { file('config/environments/production.rb') }
it 'configures the mailer asset host' do
expect(subject).to contain("config.action_mailer.asset_host = ENV.fetch('MAILER_DEFAULT_HOST')")
end
it 'configures the mailer default url options' do
expect(subject).to contain(mailer_default_url_config)
end
it 'adds the i18n configuration' do
expect(subject).to contain(i18n_config)
end
it 'removes the config.i18n.fallbacks = true' do
expect(subject).not_to contain("config.i18n.fallbacks = true")
end
it 'allows Rails serve static file' do
expect(subject).to contain('config.public_file_server.enabled = true')
end
private
def mailer_default_url_config
<<~EOT
config.action_mailer.default_url_options = {
host: ENV.fetch('MAILER_DEFAULT_HOST'),
port: ENV.fetch('MAILER_DEFAULT_PORT')
}
EOT
end
def i18n_config
<<~EOT
# eg: AVAILABLE_LOCALES = 'en,th'
config.i18n.available_locales = ENV.fetch('AVAILABLE_LOCALES').split(',')
# eg: DEFAULT_LOCALE = 'en'
config.i18n.default_locale = ENV.fetch('DEFAULT_LOCALE')
# eg: FALLBACK_LOCALES = 'en,th'
config.i18n.fallbacks = ENV.fetch('FALLBACK_LOCALES').split(',')
EOT
end
end