Skip to content

Commit 0350187

Browse files
committed
Fix mailer templates to be rubocop compliant
- spaces around array elements - only emit blank lines between new blocks of code
1 parent 5bec50b commit 0350187

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

actionmailer/lib/rails/generators/mailer/templates/mailer.rb.tt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<% module_namespacing do -%>
22
class <%= class_name %>Mailer < ApplicationMailer
3-
<% actions.each do |action| -%>
3+
<% actions.each_with_index do |action, index| -%>
4+
<% if index != 0 -%>
45

6+
<% end -%>
57
# Subject can be set in your I18n file at config/locales/en.yml
68
# with the following lookup:
79
#

railties/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@ require "test_helper"
22

33
<% module_namespacing do -%>
44
class <%= class_name %>MailerTest < ActionMailer::TestCase
5-
<% actions.each do |action| -%>
5+
<% actions.each_with_index do |action, index| -%>
6+
<% if index != 0 -%>
7+
8+
<% end -%>
69
test "<%= action %>" do
710
mail = <%= class_name %>Mailer.<%= action %>
811
assert_equal <%= action.to_s.humanize.inspect %>, mail.subject
9-
assert_equal ["[email protected]"], mail.to
10-
assert_equal ["[email protected]"], mail.from
12+
assert_equal [ "[email protected]" ], mail.to
13+
assert_equal [ "[email protected]" ], mail.from
1114
assert_match "Hi", mail.body.encoded
1215
end
13-
1416
<% end -%>
1517
<% if actions.blank? -%>
1618
# test "the truth" do
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
<% module_namespacing do -%>
22
# Preview all emails at http://localhost:3000/rails/mailers/<%= file_path %>_mailer
33
class <%= class_name %>MailerPreview < ActionMailer::Preview
4-
<% actions.each do |action| -%>
4+
<% actions.each_with_index do |action, index| -%>
5+
<% if index != 0 -%>
56

7+
<% end -%>
68
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>_mailer/<%= action %>
79
def <%= action %>
810
<%= class_name %>Mailer.<%= action %>
911
end
1012
<% end -%>
11-
1213
end
1314
<% end -%>

0 commit comments

Comments
 (0)