File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
lib/generators/rspec/mailer/templates
spec/generators/rspec/mailer Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ class <%= class_name %>Preview < ActionMailer::Preview
5
5
6
6
# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
7
7
def <%= action %>
8
- <%= class_name %> <%= Rails . version . to_f >= 5.0 ? " Mailer" : "" %>.<%= action %>
8
+ <%= Rails.version.to_f > = 5.0 ? class_name . sub ( /( Mailer)?$/ , 'Mailer' ) : class_name %>. <%= action %>
9
9
end
10
10
<% end -%>
11
11
Original file line number Diff line number Diff line change 56
56
it { is_expected . to exist }
57
57
it { is_expected . to contain ( /class PostsPreview < ActionMailer::Preview/ ) }
58
58
it { is_expected . to contain ( /def index/ ) }
59
+ if Rails . version . to_f >= 5.0
60
+ it { is_expected . to contain ( /PostsMailer.index/ ) }
61
+ else
62
+ it { is_expected . to contain ( /Posts.index/ ) }
63
+ end
59
64
it { is_expected . to contain ( /def show/ ) }
65
+ if Rails . version . to_f >= 5.0
66
+ it { is_expected . to contain ( /PostsMailer.show/ ) }
67
+ else
68
+ it { is_expected . to contain ( /Posts.show/ ) }
69
+ end
60
70
end
61
71
end
You can’t perform that action at this time.
0 commit comments