Skip to content
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

removed rails 5.0 check for mailer preview generator #2037

Merged
merged 2 commits into from
Oct 26, 2018

Conversation

koheisg
Copy link
Contributor

@koheisg koheisg commented Oct 25, 2018

before

$ rails g mailer SomeMailer some_message
Running via Spring preloader in process 68477
      create  app/mailers/some_mailer.rb
      invoke  erb
      create    app/views/some_mailer
      create    app/views/some_mailer/some_message.text.erb
      create    app/views/some_mailer/some_message.html.erb
      invoke  rspec
      create    spec/mailers/some_mailer_spec.rb
      create    spec/fixtures/some_mailer/some_message
      create    spec/mailers/previews/some_mailer_preview.rb
$ cat spec/mailers/previews/some_mailer_preview.rb
# Preview all emails at http://localhost:3000/rails/mailers/some_mailer
class SomeMailerPreview < ActionMailer::Preview

  # Preview this email at http://localhost:3000/rails/mailers/some_mailer/some_message
  def some_message
    SomeMailerMailer.some_message
  end

end

👎 SomeMailerMailer.some_message

after

$ rails g mailer SomeMailer some_message
Running via Spring preloader in process 89456
      create  app/mailers/some_mailer.rb
      invoke  erb
      create    app/views/some_mailer
      create    app/views/some_mailer/some_message.text.erb
      create    app/views/some_mailer/some_message.html.erb
      invoke  rspec
      create    spec/mailers/some_mailer_spec.rb
      create    spec/fixtures/some_mailer/some_message
      create    spec/mailers/previews/some_mailer_preview.rb
$ cat spec/mailers/previews/some_mailer_preview.rb
# Preview all emails at http://localhost:3000/rails/mailers/some_mailer
class SomeMailerPreview < ActionMailer::Preview

  # Preview this email at http://localhost:3000/rails/mailers/some_mailer/some_message
  def some_message
    SomeMailer.some_message
  end

end

👍 SomeMailer.some_message

@@ -5,7 +5,7 @@ class <%= class_name %>Preview < ActionMailer::Preview

# Preview this email at http://localhost:3000/rails/mailers/<%= file_path %>/<%= action %>
def <%= action %>
<%= class_name %><%= Rails.version.to_f >= 5.0 ? "Mailer" : "" %>.<%= action %>
<%= Rails.version.to_f >= 5.0 ? class_name.sub(/(Mailer)?$/, 'Mailer') : class_name %>.<%= action %>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we should have a spec for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I'll work on 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonRowe
I wrote test 😄
please review again.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@JonRowe JonRowe merged commit d2300fa into rspec:master Oct 26, 2018
JonRowe added a commit that referenced this pull request Oct 26, 2018
@koheisg koheisg deleted the fix-mailer-generator branch October 27, 2018 05:51
JonRowe pushed a commit that referenced this pull request Dec 26, 2018
* removed rails 5.0 check for mailer preview generator

* Add test fot mailer generator
JonRowe added a commit that referenced this pull request Dec 26, 2018
sebjacobs pushed a commit to futurelearn/rspec-rails that referenced this pull request Mar 15, 2019
* removed rails 5.0 check for mailer preview generator

* Add test fot mailer generator
sebjacobs pushed a commit to futurelearn/rspec-rails that referenced this pull request Mar 15, 2019
benoittgt pushed a commit to benoittgt/rspec-rails that referenced this pull request May 1, 2019
* removed rails 5.0 check for mailer preview generator

* Add test fot mailer generator
benoittgt pushed a commit to benoittgt/rspec-rails that referenced this pull request May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants