2014-06-23 23:39:42 +02:00
|
|
|
require 'test_helper'
|
|
|
|
|
2014-08-06 14:47:47 +02:00
|
|
|
# Test that some information is sent to submitter and moderators when notes are
|
|
|
|
# added to events
|
2014-06-23 23:39:42 +02:00
|
|
|
class NoteMailerTest < ActionMailer::TestCase
|
|
|
|
setup do
|
|
|
|
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
|
|
|
end
|
|
|
|
|
2014-07-21 01:26:58 +02:00
|
|
|
test 'notify' do
|
|
|
|
mail = NoteMailer.notify Note.last
|
2014-08-06 14:47:47 +02:00
|
|
|
assert_match(/\[Agenda du Libre\] Demande d'informations sur l'événement.*/,
|
|
|
|
mail.subject)
|
2014-06-23 23:39:42 +02:00
|
|
|
assert_equal [Note.last.event.contact], mail.to
|
2014-08-06 14:47:47 +02:00
|
|
|
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
2014-06-23 23:39:42 +02:00
|
|
|
end
|
2014-07-21 01:26:58 +02:00
|
|
|
|
|
|
|
test 'create' do
|
|
|
|
mail = NoteMailer.create Note.last
|
2014-08-06 14:47:47 +02:00
|
|
|
assert_match(/\[Agenda du Libre\] Une note a été rajoutée à l'événement.*/,
|
|
|
|
mail.subject)
|
2014-07-21 01:26:58 +02:00
|
|
|
assert_not_equal [Note.last.event.contact], mail.to
|
2014-08-06 14:47:47 +02:00
|
|
|
assert_equal ['moderateurs@agendadulibre.org'], mail.from
|
2014-07-21 01:26:58 +02:00
|
|
|
end
|
2014-06-23 23:39:42 +02:00
|
|
|
end
|