agenda-libre-ruby/test/mailers/moderation_mailer_test.rb

29 lines
981 B
Ruby
Raw Normal View History

2014-06-09 12:18:40 +02:00
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