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 expect(Mail::TestMailer.deliveries.size).to eq(0)
23 Then /^un appel pour la cotisation doit avoir été envoyé$/ do
24 expect(Mail::TestMailer.deliveries.size).to eq(1)
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 expect(Mail::TestMailer.deliveries.size).to eq(count.to_i)
47 Then /^des emails doivent avoir été envoyés à Jane, Fatima, Fred et Moly$/ do
48 recipients = Mail::TestMailer.deliveries.collect(&:to)
49 expect(recipients).to include(['jane@example.org'])
50 expect(recipients).to include(['fatima@example.org'])
51 expect(recipients).to include(['fred@example.org'])
52 expect(recipients).to include(['moly@example.org'])
55 Then /^un email doit avoir été envoyé au comité de déontologie$/ do
56 expect(Mail::TestMailer.deliveries.size).to eq(1)
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')
65 Then /^l'appel pour la cotisation doit demander confirmation de l'adresse postale$/ do
66 mail = Mail::TestMailer.deliveries.first
67 expect(mail.body).to include("vérifier que l'adresse postale")
68 expect(mail.body).to include(@last_member['address'])
72 Then /^l'appel pour la cotisation ne doit pas parler de l'adresse postale$/ do
73 mail = Mail::TestMailer.deliveries.first
74 expect(mail.body).to_not include("vérifier que l'adresse postale")