X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/8536514115cf732eec24348862e835bde52acdf1..4a99ae87e0f7fdd07d8820a724fbed1d8b2b5f36:/features/step_definitions/subscriptions.rb diff --git a/features/step_definitions/subscriptions.rb b/features/step_definitions/subscriptions.rb index aa3365d..a4827f5 100644 --- a/features/step_definitions/subscriptions.rb +++ b/features/step_definitions/subscriptions.rb @@ -1,7 +1,28 @@ +#-*- coding: utf-8 -*- + Given /une base de membres vide$/ do create_dir 'Membres' end +Given /^(?:une base )?avec (\w+)(, à jour de cotisation| qui n'a pas payé sa cotisation cette année)$/ do |name, uptodate| + case uptodate + when ', à jour de cotisation' + # ± 1 month ago + paid_on = (Time.now - 3600*24*30).strftime('%Y-%m-%d') + else + # ± 15 months ago + paid_on = (Time.now - 3600*24*30*15).strftime('%Y-%m-%d') + end + data = { 'name' => name, + 'address' => "At #{name}", + 'email' => "#{name.downcase}@example.org", + 'membership_fee_paid_on' => paid_on + } + create_dir 'Membres' + file = subscription_filename_for_id(new_id) + write_file file, render_subscription_file(data) +end + When /^j'ajoute une fiche correcte pour une nouvelle adhésion$/ do @file = subscription_filename_for_id(new_id) write_file @file, render_subscription_file(EXTRA_SUBSCRIPTION)