Tests: Add a helper method to reduce sleeping times in test.
This will 'time travel', i.e. change the inserted_at and update_at fields of the object in question. This is used to backdate things were we used sleeping before to ensure time differences.
This commit is contained in:
parent
ba19975838
commit
0ef0aed205
5 changed files with 18 additions and 11 deletions
|
|
@ -96,12 +96,11 @@ defmodule Pleroma.Conversation.ParticipationTest do
|
|||
{:ok, %Participation{} = participation} =
|
||||
Participation.create_for_user_and_conversation(user, conversation)
|
||||
|
||||
{:ok, participation} = time_travel(participation, -2)
|
||||
|
||||
assert participation.user_id == user.id
|
||||
assert participation.conversation_id == conversation.id
|
||||
|
||||
# Needed because updated_at is accurate down to a second
|
||||
:timer.sleep(1000)
|
||||
|
||||
# Creating again returns the same participation
|
||||
{:ok, %Participation{} = participation_two} =
|
||||
Participation.create_for_user_and_conversation(user, conversation)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue