1 # frozen_string_literal: true
3 require "factory_bot_rails"
5 class UserMailerPreview < ActionMailer::Preview
6 include FactoryBot::Syntax::Methods
8 # Wraps the preview in a transaction, so that no changes
9 # are persisted to the development db
12 ActiveRecord::Base.transaction do
14 raise ActiveRecord::Rollback
20 user = create(:user, :languages => [I18n.locale])
21 token = "token-123456"
22 UserMailer.signup_confirm(user, token)
26 user = create(:user, :languages => [I18n.locale], :new_email => "newemail@example.com")
27 token = "token-123456"
28 UserMailer.email_confirm(user, token)
32 user = create(:user, :languages => [I18n.locale])
33 token = "token-123456"
34 UserMailer.lost_password(user, token)
37 def diary_comment_notification
38 recipient = create(:user, :languages => [I18n.locale])
39 diary_entry = create(:diary_entry)
40 diary_comment = create(:diary_comment, :diary_entry => diary_entry)
41 UserMailer.diary_comment_notification(diary_comment, recipient)