forked from rspec/rspec-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_action_mailer_specs.rb
31 lines (28 loc) · 1.09 KB
/
generate_action_mailer_specs.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
require 'active_support'
require 'active_support/core_ext/module'
using_source_path(File.expand_path(__dir__)) do
# Comment out the default mailer stuff
comment_lines 'config/environments/development.rb', /action_mailer/
comment_lines 'config/environments/test.rb', /action_mailer/
initializer 'action_mailer.rb', <<-CODE
require "action_view/base"
if ENV['DEFAULT_URL']
ExampleApp::Application.configure do
config.action_mailer.default_url_options = { :host => ENV['DEFAULT_URL'] }
end
end
CODE
gsub_file 'config/initializers/action_mailer.rb',
/ExampleApp/,
Rails.application.class.parent.to_s
copy_file 'spec/support/default_preview_path'
chmod 'spec/support/default_preview_path', 0755
gsub_file 'spec/support/default_preview_path',
/ExampleApp/,
Rails.application.class.parent.to_s
if skip_active_record?
comment_lines 'spec/support/default_preview_path', /active_record/
comment_lines 'spec/support/default_preview_path', /active_storage/
end
copy_file 'spec/verify_mailer_preview_path_spec.rb'
end