-
-
Notifications
You must be signed in to change notification settings - Fork 1k
removed rails 5.0 check for mailer spec generator #1729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi, this needs to be here as the recommended way to add a mailer in Rails 5 is |
@JonRowe Oh ok got it will change accordingly, Thank you. |
7ce37af
to
c9c4841
Compare
@JonRowe Fixed. Please check it. |
@@ -1,10 +1,10 @@ | |||
require "rails_helper" | |||
|
|||
<% module_namespacing do -%> | |||
RSpec.describe <%= class_name %><%= Rails.version.to_f >= 5.0 ? "Mailer" : "" %>, <%= type_metatag(:mailer) %> do | |||
RSpec.describe <%= class_name.gsub(/Mailer$/i, '') %><%= Rails.version.to_f >= 5.0 ? "Mailer" : "" %>, <%= type_metatag(:mailer) %> do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer it if we did this like this:
<%= Rails.version.to_f >= 5.0 ? class_name.gsub(/(Mailer)?$/i, 'Mailer') : class_name %>
As this will only run the modification on the edge case we know exists.
Thanks, I've suggested a slight improvement, see what you think :) |
c9c4841
to
fdcbb91
Compare
@JonRowe Modified. Please review. Thanks |
👍 😄 |
Removed unnecessary code in
lib/generators/rspec/mailer/templates/mailer_spec.rb
Now if we give
rails g mailer CommentMailer
it generates the correct files/classes with file
comment_mailer_spec.rb
containing asdescribe
CommentMailer
instead ofCommentMailerMailer
Fixed: #1727