Fix tests
authorRoman Chvanikov <chvanikoff@gmail.com>
Tue, 4 Jun 2019 00:38:53 +0000 (03:38 +0300)
committerRoman Chvanikov <chvanikoff@gmail.com>
Tue, 4 Jun 2019 00:38:53 +0000 (03:38 +0300)
test/mix/tasks/pleroma.digest_test.exs

index 3dafe05fefcea09fc3fd3795b47711ad1ba2a1f5..595f64ed70e3d95e8f4d45ab1ee94d6ba9fa5926 100644 (file)
@@ -28,9 +28,18 @@ defmodule Mix.Tasks.Pleroma.DigestTest do
           })
       end)
 
-      Mix.Tasks.Pleroma.Digest.run(["test", user2.nickname])
+      yesterday =
+        NaiveDateTime.add(
+          NaiveDateTime.truncate(NaiveDateTime.utc_now(), :second),
+          -60 * 60 * 24,
+          :second
+        )
 
-      assert_received {:mix_shell, :info, [message]}
+      {:ok, yesterday_date} = Timex.format(yesterday, "%F", :strftime)
+
+      :ok = Mix.Tasks.Pleroma.Digest.run(["test", user2.nickname, yesterday_date])
+
+      assert_receive {:mix_shell, :info, [message]}
       assert message =~ "Digest email have been sent"
 
       assert_email_sent(