The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

23 lines
900 B

  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe AdminMailer, type: :mailer do
  4. describe '.new_report' do
  5. let(:sender) { Fabricate(:account, username: 'John', user: Fabricate(:user)) }
  6. let(:recipient) { Fabricate(:account, username: 'Mike', user: Fabricate(:user, locale: :en)) }
  7. let(:report) { Fabricate(:report, account: sender, target_account: recipient) }
  8. let(:mail) { described_class.new_report(recipient, report) }
  9. it 'renders the headers' do
  10. expect(mail.subject).to eq("New report for cb6e6126.ngrok.io (##{report.id})")
  11. expect(mail.to).to eq [recipient.user_email]
  12. expect(mail.from).to eq ['notifications@localhost']
  13. end
  14. it 'renders the body' do
  15. expect(mail.body.encoded).to eq("Mike,\r\n\r\nJohn has reported Mike\r\n\r\nView: https://cb6e6126.ngrok.io/admin/reports/#{report.id}\r\n")
  16. end
  17. end
  18. end