3 # Système de gestion des adhésions de Nos oignons
4 # Copyright © 2013-2014 Nos oignons <contact@nos-oignons.net>
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.
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.
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/>.
19 When /^j'exécute list\-emails$/ do
20 run_simple 'list-emails'
23 When /^j'exécute list-emails le (\d+)\-(\d+)\-(\d+)$/ do |year, month, day|$/
24 Timecop.travel(Time.new(year, month, day)) do
25 stdout_io = StringIO.new
28 NosOignons.list_emails!
29 @stdout = stdout_io.string
36 When /^j'exécute update-ag-subscribers$/ do
37 run_simple 'update-ag-subscribers'
40 When /^(?:que )?j'exécute send-membership-reminders$/ do
41 NosOignons.send_membership_reminders!
44 When /^(?:que )?j'exécute send-membership-reminders le ([0-9]{4})-([0-9]{2})-([0-9]{2})$/ do |year, month, day|
45 Timecop.travel(Date.new(year.to_i, month.to_i, day.to_i)) do
46 NosOignons.send_membership_reminders!
50 When /^j'exécute send\-member\-emails\-to\-advisors$/ do
51 NosOignons.send_member_emails_to_advisors!
54 When /^j'exécute `(create\-membership\-fee\-receipt.*)`$/ do |cmd|
58 Then /^je ne dois pas avoir eu d'erreur$/ do
62 Then /^je dois voir comme erreur "(.*?)"$/ do |expected|
63 assert_failing_with(expected)
66 Then /^la sortie doit être vide$/ do
67 assert_exact_output('', @stdout || all_stdout)
70 Then /^la sortie doit être:$/ do |expected|
71 # add an extra line feed for nice scenario
72 assert_exact_output(expected + "\n", @stdout || all_stdout)
75 Then /^la sortie doit être "([^"]*)"$/ do |expected|
76 assert_exact_output(expected, (@stdout || all_stdout).rstrip)