]> nos-oignons.net Git - gestion-adh.git/blob - features/step_definitions/git.rb
Mise à jour des dépendences et correction des tests
[gestion-adh.git] / features / step_definitions / git.rb
1 #-*- coding: utf-8 -*-
2 #
3 # Système de gestion des adhésions de Nos oignons
4 # Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
5 #
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.
10 #
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.
15 #
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/>.
18
19 require 'fileutils'
20
21 Given /^un clone du Git contenant les adhésions$/ do
22   # Create main repository
23   @main_repository_path = expand_path('main')
24   create_directory 'main'
25   cd 'main'
26   run_simple 'git init --quiet --bare'
27   cd '..'
28
29   # Clone it now
30   run_simple "git clone --quiet --local file://#{expand_path('.')}/main clone"
31   cd 'clone'
32   create_directory 'Membres'
33   BASE_MEMBERS.each_pair do |number, data|
34     file = member_filename_for_id(number)
35     File.write file, render_member_file(data)
36     run_simple "git add #{file}"
37   end
38   run_simple 'git commit -m "Initial data set from fixtures"'
39   run_simple 'git push --quiet origin master'
40 end
41
42 Given /^le « pre-commit hook » correctement configuré$/ do
43   FileUtils.ln_s File.expand_path('../../../bin/pre-commit-hook', __FILE__),
44                  "#{expand_path('.')}/.git/hooks/pre-commit"
45 end
46
47 Given /^le « pre-receive hook » configuré sur le dépôt principal$/ do
48   FileUtils.ln_s File.expand_path('../../../bin/pre-receive-hook', __FILE__),
49                  "#{@main_repository_path}/hooks/pre-receive"
50 end
51
52 When /je fais un `commit` du nouveau fichier$/ do
53   run_simple "git add #{@file}"
54   run_simple "git commit #{@file} -m 'new file'", false # do not fail on error
55 end
56
57 When /je pousse la modification$/ do
58   run_simple "git add #{@file}"
59   run_simple "git commit #{@file} -m 'new file'"
60   run_simple 'git push origin master', false # do not fail on error
61 end