Merge pull request #760 from metamaps/feature/mailer-tests
tests for map_mailer.rb
This commit is contained in:
commit
da5191171a
3 changed files with 23 additions and 1 deletions
|
@ -1,3 +1,7 @@
|
||||||
if ENV['COVERAGE'] == 'on'
|
if ENV['COVERAGE'] == 'on'
|
||||||
SimpleCov.start 'rails'
|
SimpleCov.start 'rails' do
|
||||||
|
add_group 'Policies', 'app/policies'
|
||||||
|
add_group 'Services', 'app/services'
|
||||||
|
add_group 'Serializers', 'app/serializers'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -30,6 +30,7 @@ Metamaps::Application.configure do
|
||||||
# The :test delivery method accumulates sent emails in the
|
# The :test delivery method accumulates sent emails in the
|
||||||
# ActionMailer::Base.deliveries array.
|
# ActionMailer::Base.deliveries array.
|
||||||
config.action_mailer.delivery_method = :test
|
config.action_mailer.delivery_method = :test
|
||||||
|
config.action_mailer.default_url_options = { host: 'localhost:3000' }
|
||||||
|
|
||||||
# Print deprecation notices to the stderr
|
# Print deprecation notices to the stderr
|
||||||
config.active_support.deprecation = :stderr
|
config.active_support.deprecation = :stderr
|
||||||
|
|
17
spec/mailers/map_mailer_spec.rb
Normal file
17
spec/mailers/map_mailer_spec.rb
Normal 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
|
Loading…
Reference in a new issue