diff options
author | ysksn <bluewhale1982@gmail.com> | 2018-12-21 17:34:34 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2018-12-21 09:34:34 +0100 |
commit | de3cecf37a1d6865063c88b2eae5431625a296b2 (patch) | |
tree | 3d506cdbfb72ba37da9bde1618320c696db195e4 /spec | |
parent | 1bc78ec50e1ce80ce0b5dea5fb98ba812852c6b5 (diff) |
Add specs for AdminMailer (#9597)
Diffstat (limited to 'spec')
-rw-r--r-- | spec/mailers/admin_mailer_spec.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/mailers/admin_mailer_spec.rb b/spec/mailers/admin_mailer_spec.rb new file mode 100644 index 000000000..4a8ef7b5e --- /dev/null +++ b/spec/mailers/admin_mailer_spec.rb @@ -0,0 +1,22 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe AdminMailer, type: :mailer do + describe '.new_report' do + let(:sender) { Fabricate(:account, username: 'John', user: Fabricate(:user)) } + let(:recipient) { Fabricate(:account, username: 'Mike', user: Fabricate(:user, locale: :en)) } + let(:report) { Fabricate(:report, account: sender, target_account: recipient) } + let(:mail) { described_class.new_report(recipient, report) } + + it 'renders the headers' do + expect(mail.subject).to eq("New report for cb6e6126.ngrok.io (##{report.id})") + expect(mail.to).to eq [recipient.user_email] + expect(mail.from).to eq ['notifications@localhost'] + end + + it 'renders the body' do + 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") + end + end +end |