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 /^le fichier "(.*)" doit avoir été créé avec les reçus$/ do |filename|
20 @receipt_path = "#{ENV['NOS_OIGNONS_RECEIPTS_DIR']}/#{filename}"
21 expect(File.exists?(@receipt_path)).to be_true
24 Then /^il doit contenir le nom et l'adresse de (\w+), la date et le montant de la cotisation$/ do |name|
25 # XXX: not nice to hard code that 10,00
27 # XXX: not nice to relay that it's the last member either
28 expect(@last_member['name']).to eql(name)
30 content = `pdftotext #{@receipt_path} -`.gsub(/\n/, ' ')
31 expect(content).to include(@last_member['name'])
32 expect(content).to include(@last_member['address'])
33 expect(content).to include(DateTime.strptime(@last_member['membership_fee_paid_on'], "%Y-%m-%d").strftime("%d/%m/%Y"))
34 expect(content).to include(amount)