Skip to content

Commit a00b536

Browse files
committed
Fix log tests
1 parent 0e7ab7d commit a00b536

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/cadet/jobs/log_test.exs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ defmodule Cadet.Jobs.LogEntryTest do
2020
test "returns true (job runs) when log entry old enough" do
2121
%LogEntry{
2222
name: @name,
23-
last_run: Timex.subtract(DateTime.truncate(Timex.now(), :second), Duration.from_hours(25))
23+
last_run:
24+
Timex.now()
25+
|> Timex.subtract(Duration.from_hours(25))
26+
|> DateTime.truncate(:second)
2427
}
2528
|> Repo.insert!()
2629

@@ -37,7 +40,10 @@ defmodule Cadet.Jobs.LogEntryTest do
3740
test "returns false (job does not run) when log entry too recent" do
3841
%LogEntry{
3942
name: @name,
40-
last_run: Timex.subtract(DateTime.truncate(Timex.now(), :second), Duration.from_hours(23))
43+
last_run:
44+
Timex.now()
45+
|> Timex.subtract(Duration.from_hours(23))
46+
|> DateTime.truncate(:second)
4147
}
4248
|> Repo.insert!()
4349

0 commit comments

Comments
 (0)