]> nos-oignons.net Git - gestion-adh.git/blobdiff - features/support/fixtures.rb
Modification du traitement des adresses postales pour les rendre optionnelles
[gestion-adh.git] / features / support / fixtures.rb
index d9d91deae40d0775c5ab74406b2782c17ac990c7..0d01e20ee739f0864710569674a611a27bc66904 100644 (file)
@@ -1,4 +1,20 @@
 #-*- coding: utf-8 -*-
+#
+# Système de gestion des adhésions de Nos oignons
+# Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 require 'erb'
 require 'ostruct'
@@ -13,16 +29,14 @@ BASE_MEMBERS = YAML.load(<<END_OF_YAML)
     75009 Paris
     FR
   email: registry@domainnetwork.fr
+  joined_on: 2013-02-21
   membership_fee_paid_on: 2013-02-21
   notes:
     Il vient de `whois cogent.fr`.
 000002:
   name: Sylvain Dufier
-  address: |
-    ORANGE FRANCE
-    13, rue de Javel
-    75015 Paris
   email: sylvain.dufier@orange-ftgroup.com
+  joined_on: 2013-05-20
   membership_fee_paid_on: 2013-05-29
     Il vient de `whois orange.fr`.
 000003:
@@ -32,7 +46,8 @@ BASE_MEMBERS = YAML.load(<<END_OF_YAML)
     15, rue de la Nuee Bleue
     67000 Strasbourg
   email: domaines@sdv.fr
-  membership_fee_paid_on: 2010-01-21
+  joined_on: 2010-01-21
+  membership_fee_paid_on: 2011-01-11
     Il vient de `whois numericable.fr`.
     Et il n'est pas à jour de cotisation.
 END_OF_YAML
@@ -44,6 +59,7 @@ address: |
   42, avenue de Friedland
   75008 Paris
 email: domains@sfr.com
+joined_on: 2013-04-04
 membership_fee_paid_on: 2013-04-04
 notes:
   Il vient de `whois sfr.fr`.
@@ -52,17 +68,21 @@ END_OF_YAML
 MEMBER_FILE_TEMPLATE = <<'END_OF_TEMPLATE'
 ---
 name: <%= name %>
+<% unless address.nil? %>
 address: |
 <%= address.gsub(/^/, '  ').rstrip %>
+<% end %>
 email: <%= email %>
+joined_on: <%= joined_on %>
 membership_fee_paid_on: <%= membership_fee_paid_on %>
 ---
+[[!ftemplate id="membre"]]
 
 <%= notes %>
 END_OF_TEMPLATE
 
 def member_filename_for_id(id)
-  "Membres/%06d.mdwn" % id
+  expand_path("Membres/%06d.mdwn" % id)
 end
 
 def render_member_file(locals)
@@ -70,7 +90,7 @@ def render_member_file(locals)
 end
 
 def new_id
-  max_id = Dir.glob("#{current_dir}/Membres/*.mdwn").
+  max_id = Dir.glob("#{expand_path('Membres')}/*.mdwn").
     collect { |f| File.basename(f).gsub(/\.mdwn$/, '').to_i }.max || 0
   max_id + 1
 end