X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/f6e098c942a89d011c0875783bd0d0db54e4b67a..0b86faada8b828ca94b735ec4bf88b7e024f16a3:/features/step_definitions/commands.rb?ds=sidebyside diff --git a/features/step_definitions/commands.rb b/features/step_definitions/commands.rb index 0aec8b6..cde2215 100644 --- a/features/step_definitions/commands.rb +++ b/features/step_definitions/commands.rb @@ -4,6 +4,35 @@ When /^j'exécute list\-emails$/ do run_simple 'list-emails' end +When /^j'exécute list-emails le (\d+)\-(\d+)\-(\d+)$/ do |year, month, day|$/ + Timecop.travel(Time.new(year, month, day)) do + stdout_io = StringIO.new + begin + $stdout = stdout_io + NosOignons.list_emails! + @stdout = stdout_io.string + ensure + $stdout = STDOUT + end + end +end + +When /^j'exécute update-ag-subscribers$/ do + run_simple 'update-ag-subscribers' +end + +When /^(?:que )?j'exécute send-membership-reminders$/ do + NosOignons.send_membership_reminders! +end + +When /^j'exécute send\-member\-emails\-to\-advisors$/ do + NosOignons.send_member_emails_to_advisors! +end + +When /^j'exécute `(create\-membership\-fee\-receipt.*)`$/ do |cmd| + run_simple cmd, false +end + Then /^je ne dois pas avoir eu d'erreur$/ do assert_exit_status(0) end @@ -13,10 +42,14 @@ Then /^je dois voir comme erreur "(.*?)"$/ do |expected| end Then /^la sortie doit être vide$/ do - assert_exact_output('', all_stdout) + assert_exact_output('', @stdout || all_stdout) end Then /^la sortie doit être:$/ do |expected| # add an extra line feed for nice scenario - assert_exact_output(expected + "\n", all_stdout) + assert_exact_output(expected + "\n", @stdout || all_stdout) +end + +Then /^la sortie doit être "([^"]*)"$/ do |expected| + assert_exact_output(expected, (@stdout || all_stdout).rstrip) end