2016-10-13 07:39:13 +00:00
|
|
|
require 'rails_helper'
|
|
|
|
|
|
|
|
RSpec.describe MapMailer, type: :mailer do
|
2016-10-17 14:53:53 +00:00
|
|
|
describe 'access_request_email' do
|
|
|
|
let(:request) { create(:access_request) }
|
|
|
|
let(:map) { create(:map) }
|
|
|
|
let(:mail) { described_class.access_request_email(request, map) }
|
|
|
|
|
|
|
|
it { expect(mail.from).to eq ['team@metamaps.cc'] }
|
|
|
|
it { expect(mail.to).to eq [map.user.email] }
|
|
|
|
it { expect(mail.subject).to match map.name }
|
|
|
|
it { expect(mail.body.encoded).to match map.name }
|
|
|
|
it { expect(mail.body.encoded).to match request.user.name }
|
2016-11-07 19:40:25 +00:00
|
|
|
it { expect(mail.body.encoded).to match 'Allow' }
|
|
|
|
it { expect(mail.body.encoded).to match 'Decline' }
|
2016-10-17 14:53:53 +00:00
|
|
|
end
|
|
|
|
|
2016-10-13 07:39:13 +00:00
|
|
|
describe 'invite_to_edit_email' do
|
2016-10-17 14:53:53 +00:00
|
|
|
let(:map) { create(:map) }
|
|
|
|
let(:inviter) { create(:user) }
|
|
|
|
let(:invitee) { create(:user) }
|
2016-10-13 07:39:13 +00:00
|
|
|
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
|