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 NosOignons.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|
55 run_simple cmd, :fail_on_error => false
58 Then /^je ne dois pas avoir eu d'erreur$/ do
59 expect(last_command_started).to have_exit_status(0)
62 Then /^je dois voir comme erreur "(.*?)"$/ do |expected|
63 expect(last_command_started).to have_output_on_stderr /#{Regexp.escape(expected)}/
66 Then /^la sortie doit être vide$/ do
67 expect(last_command_started).to have_output_on_stdout('')
70 Then /^la sortie doit être:$/ do |expected|
71 # add an extra line feed for nice scenario
72 expect(last_command_started).to have_output_on_stdout(expected)
75 Then /^la sortie doit être "([^"]*)"$/ do |expected|
77 expect(last_command_started).to have_output_on_stdout(expected)
78 rescue Aruba::NoCommandHasBeenStartedError
79 expect(@stdout.rstrip).to eq(expected)