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

29 lines
1.0 KiB
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
2014-06-23 23:39:42 +02:00
mail = ModerationMailer.create(Event.unscoped.last)
2014-06-09 12:18:40 +02:00
assert_match(/\[Agenda du Libre\] Nouvel évènement à modérer: .*/, mail.subject)
2014-06-23 23:39:42 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.to
2014-06-09 12:18:40 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.from
end
test "update" do
2014-06-23 23:39:42 +02:00
mail = ModerationMailer.update(Event.unscoped.last, User.last)
2014-06-09 12:18:40 +02:00
assert_match(/\[Agenda du Libre\] Édition de l'évènement .*/, mail.subject)
2014-06-23 23:39:42 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.to
2014-06-09 12:18:40 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.from
end
test "moderate" do
2014-06-23 23:39:42 +02:00
mail = ModerationMailer.moderate(Event.unscoped.last, User.last)
2014-06-09 12:18:40 +02:00
assert_match(/\[Agenda du Libre\] Évènement .* modéré/, mail.subject)
2014-06-23 23:39:42 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.to
2014-06-09 12:18:40 +02:00
assert_equal ["moderateurs@agendadulibre.org"], mail.from
end
end