]> nos-oignons.net Git - gestion-adh.git/blob - features/step_definitions/receipts.rb
7caa60b86b81ddaf56a70b71298f04207a988972
[gestion-adh.git] / features / step_definitions / receipts.rb
1 #-*- coding: utf-8 -*-
2
3 Then /^le fichier "(.*)" doit avoir été créé avec les reçus$/ do |filename|
4   @receipt_path = "#{ENV['NOS_OIGNONS_RECEIPTS_DIR']}/#{filename}"
5   expect(File.exists?(@receipt_path)).to be_true
6 end
7
8 Then /^il doit contenir le nom et l'adresse de (\w+), la date et le montant de la cotisation$/ do |name|
9   # XXX: not nice to hard code that 10,00
10   amount = "10,00"
11   # XXX: not nice to relay that it's the last member either
12   expect(@last_member['name']).to eql(name)
13
14   content = `pdftotext #{@receipt_path} -`.gsub(/\n/, ' ')
15   expect(content).to include(@last_member['name'])
16   expect(content).to include(@last_member['address'])
17   expect(content).to include(DateTime.strptime(@last_member['membership_fee_paid_on'], "%Y-%m-%d").strftime("%d/%m/%Y"))
18   expect(content).to include(amount)
19 end