Skip to content

Commit

Permalink
Update mailer previews
Browse files Browse the repository at this point in the history
Add correct setup data to make mailers work.

Issues
------
- Closes #65
  • Loading branch information
stevepolitodesign committed Jan 10, 2022
1 parent b04b5e3 commit 152e986
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/mailers/previews/user_mailer_preview.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ class UserMailerPreview < ActionMailer::Preview
# Preview this email at http://localhost:3000/rails/mailers/user_mailer/confirmation
def confirmation
@unconfirmed_user = User.find_by(email: "unconfirmed_user@example.com") || User.create!(email: "unconfirmed_user@example.com", password: "password", password_confirmation: "password")
UserMailer.confirmation(@unconfirmed_user)
@unconfirmed_user.update!(confirmed_at: nil)
confirmation_token = @unconfirmed_user.generate_confirmation_token
UserMailer.confirmation(@unconfirmed_user, confirmation_token)
end

# Preview this email at http://localhost:3000/rails/mailers/user_mailer/password_reset
def password_reset
@password_reset_user = User.find_by(email: "password_reset_user@example.com") || User.create!(email: "password_reset_user@example.com", password: "password", password_confirmation: "password")
UserMailer.password_reset(@password_reset_user)
@password_reset_user = User.find_by(email: "password_reset_user@example.com") || User.create!(email: "password_reset_user@example.com", password: "password", password_confirmation: "password", confirmed_at: Time.current)
password_reset_token = @password_reset_user.generate_password_reset_token
UserMailer.password_reset(@password_reset_user, password_reset_token)
end
end

0 comments on commit 152e986

Please sign in to comment.