29 lines
981 B
Ruby
29 lines
981 B
Ruby
|
require 'test_helper'
|
||
|
|
||
|
class ModerationMailerTest < ActionMailer::TestCase
|
||
|
setup do
|
||
|
ActionMailer::Base.default_url_options[:host] = 'localhost:3000'
|
||
|
end
|
||
|
|
||
|
test "create" do
|
||
|
mail = ModerationMailer.create(Event.last)
|
||
|
assert_match(/\[Agenda du Libre\] Nouvel évènement à modérer: .*/, mail.subject)
|
||
|
assert_equal ["to@example.org"], mail.to
|
||
|
assert_equal ["moderateurs@agendadulibre.org"], mail.from
|
||
|
end
|
||
|
|
||
|
test "update" do
|
||
|
mail = ModerationMailer.update(Event.last, User.last)
|
||
|
assert_match(/\[Agenda du Libre\] Édition de l'évènement .*/, mail.subject)
|
||
|
assert_equal ["to@example.org"], mail.to
|
||
|
assert_equal ["moderateurs@agendadulibre.org"], mail.from
|
||
|
end
|
||
|
|
||
|
test "moderate" do
|
||
|
mail = ModerationMailer.moderate(Event.last, User.last)
|
||
|
assert_match(/\[Agenda du Libre\] Évènement .* modéré/, mail.subject)
|
||
|
assert_equal ["to@example.org"], mail.to
|
||
|
assert_equal ["moderateurs@agendadulibre.org"], mail.from
|
||
|
end
|
||
|
end
|