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
 
  19   def diary_comment_notification
 
  20     recipient = create(:user, :languages => [I18n.locale])
 
  21     diary_entry = create(:diary_entry)
 
  22     diary_comment = create(:diary_comment, :diary_entry => diary_entry)
 
  23     UserMailer.diary_comment_notification(diary_comment, recipient)