houdini/lib/templates/rspec/mailer/preview.rb.tt

17 lines
565 B
Text
Raw Normal View History

2020-05-01 19:28:55 +00:00
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
<% module_namespacing do -%>
# Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>
class <%= class_name %>Preview < ActionMailer::Preview
<% actions.each do |action| -%>
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
def <%= action %>
<%= Rails.version.to_f >= 5.0 ? class_name.sub(/(Mailer)?$/, 'Mailer') : class_name %>.<%= action %>
end
<% end -%>
end
<% end -%>