3 # Système de gestion des adhésions de Nos oignons
4 # Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU Affero General Public License for more details.
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 Then /^aucun email ne doit avoir été envoyé$/ do
20 Mail::TestMailer.deliveries.should be_empty
23 Then /^un appel pour la cotisation doit avoir été envoyé$/ do
24 Mail::TestMailer.deliveries.should have(1).email
25 mail = Mail::TestMailer.deliveries.first
26 expect(mail.from).to eql([NosOignons::BOARD_EMAIL])
27 expect(mail.to).to eql([@last_member['email']])
28 expect(mail.subject).to include('Renouvellement de votre cotisation')
29 expect(mail.body).to include(@last_member['name'])
30 expect(mail.body).to include('30 jours')
33 Then /^l'appel envoyé doit demander de vérifier l'adresse postale$/ do
34 mail = Mail::TestMailer.deliveries.first
35 expect(mail.body.to_s.gsub(/^ */, '')).to include(@last_member['address'])
38 Then /^un (premier|dernier) rappel pour la cotisation doit avoir été envoyé$/ do |kind|
39 mail = Mail::TestMailer.deliveries.first
40 expect(mail.subject).to include("(#{kind == 'premier' ? '' : 'dernier '}rappel)")
43 Then /^(\d+) emails? (?:doit|doivent) avoir été envoyés?$/ do |count|
44 Mail::TestMailer.deliveries.should have(count).email
47 Then /^des emails doivent avoir été envoyés à Jane, Fatima, Fred et Moly$/ do
48 recipients = Mail::TestMailer.deliveries.collect(&:to)
49 recipients.should include(['jane@example.org'])
50 recipients.should include(['fatima@example.org'])
51 recipients.should include(['fred@example.org'])
52 recipients.should include(['moly@example.org'])
55 Then /^un email doit avoir été envoyé au comité de déontologie$/ do
56 expect(Mail::TestMailer.deliveries).to have(1).email
57 expect(Mail::TestMailer.deliveries.first.to).to include('deontologie@nos-oignons.net')
60 Then /^il doit contenir les adresses emails de Jane et Fred$/ do
61 expect(Mail::TestMailer.deliveries.first.body).to include('jane@example.org')
62 expect(Mail::TestMailer.deliveries.first.body).to include('fred@example.org')