]> nos-oignons.net Git - gestion-adh.git/blobdiff - features/step_definitions/commands.rb
Add join date, fix renewal logic and add ability to specify path to wiki-ca
[gestion-adh.git] / features / step_definitions / commands.rb
index 685aa158906edabe144cb84c55a3295c9a8a78c1..26886e6e2662b6f3c5e5ed5afdab968c0e128682 100644 (file)
@@ -4,6 +4,19 @@ 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
@@ -17,10 +30,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