X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/8bbb07a1bc5db944ba95fa5951ed40c3c1b968aa..be6a632a1da26943671b63a50b080ff10d830273:/features/support/fixtures.rb?ds=sidebyside diff --git a/features/support/fixtures.rb b/features/support/fixtures.rb index 47290c7..8280d79 100644 --- a/features/support/fixtures.rb +++ b/features/support/fixtures.rb @@ -4,7 +4,7 @@ require 'erb' require 'ostruct' require 'yaml' -BASE_SUBSCRIPTIONS = YAML.load(< address: | <%= address.gsub(/^/, ' ').rstrip %> email: <%= email %> -mumbership_fee_paid_on: <%= membership_fee_paid_on %> +joined_on: <%= joined_on %> +membership_fee_paid_on: <%= membership_fee_paid_on %> --- +[[!ftemplate id="membre"]] <%= notes %> END_OF_TEMPLATE -def subscription_filename_for_id(id) +def member_filename_for_id(id) "Membres/%06d.mdwn" % id end -def render_subscription_file(locals) - ERB.new(SUBSCRIPTION_FILE_TEMPLATE).result(OpenStruct.new(locals).instance_eval { binding }) +def render_member_file(locals) + ERB.new(MEMBER_FILE_TEMPLATE).result(OpenStruct.new(locals).instance_eval { binding }) end def new_id - new_id = Dir.glob("#{current_dir}/Membres/*.mdwn"). - collect { |f| File.basename(f).gsub(/\.mdwn$/, '').to_i }.max + 1 + max_id = Dir.glob("#{current_dir}/Membres/*.mdwn"). + collect { |f| File.basename(f).gsub(/\.mdwn$/, '').to_i }.max || 0 + max_id + 1 end