mailer spec

This commit is contained in:
Devin Howard 2016-10-13 15:39:13 +08:00
parent 407ac1f29c
commit 26a8cddd14
2 changed files with 18 additions and 0 deletions

View file

@ -30,6 +30,7 @@ Metamaps::Application.configure do
# The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.action_mailer.default_url_options = { host: 'localhost:3000' }
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr

View file

@ -0,0 +1,17 @@
require 'rails_helper'
RSpec.describe MapMailer, type: :mailer do
let(:map) { create(:map) }
let(:inviter) { create(:user) }
let(:invitee) { create(:user) }
describe 'invite_to_edit_email' do
let(:mail) { described_class.invite_to_edit_email(map, inviter, invitee) }
it { expect(mail.from).to eq ['team@metamaps.cc'] }
it { expect(mail.to).to eq [invitee.email] }
it { expect(mail.subject).to match map.name }
it { expect(mail.body.encoded).to match inviter.name }
it { expect(mail.body.encoded).to match map.name }
it { expect(mail.body.encoded).to match map_url(map) }
end
end