Avoid using sleep in the API specs
This commit is contained in:
parent
5df1e08610
commit
b1cc37e939
3 changed files with 10 additions and 8 deletions
|
|
@ -143,11 +143,12 @@ describe Api::V1::ConversationsController do
|
|||
|
||||
describe "#index" do
|
||||
before do
|
||||
post api_v1_conversations_path, params: @conversation_request
|
||||
@read_conversation_guid = response_body(response)["guid"]
|
||||
@read_conversation = conversation_service.find!(@read_conversation_guid)
|
||||
post api_v1_conversations_path, params: @conversation_request
|
||||
sleep(1)
|
||||
Timecop.travel(1.hour.ago) do
|
||||
post api_v1_conversations_path, params: @conversation_request
|
||||
@read_conversation_guid = response_body(response)["guid"]
|
||||
@read_conversation = conversation_service.find!(@read_conversation_guid)
|
||||
post api_v1_conversations_path, params: @conversation_request
|
||||
end
|
||||
post api_v1_conversations_path, params: @conversation_request
|
||||
@conversation_guid = response_body(response)["guid"]
|
||||
@conversation = conversation_service.find!(@conversation_guid)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ describe Api::Paging::TimePaginator do
|
|||
text: "Post #{i}",
|
||||
public: public
|
||||
)
|
||||
sleep(0.01.seconds)
|
||||
Timecop.travel(1.hour.from_now)
|
||||
end
|
||||
@alice_search = alice.posts.where(public: true)
|
||||
@limit = 2
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ describe ConversationService do
|
|||
participant_ids: [bob.person.id]
|
||||
}
|
||||
@conversation = alice.build_conversation(opts)
|
||||
@conversation.save
|
||||
@conversation.created_at = 2.hours.ago
|
||||
@conversation.save!
|
||||
end
|
||||
|
||||
describe "#all_for_user" do
|
||||
|
|
@ -19,8 +20,8 @@ describe ConversationService do
|
|||
participant_ids: [bob.person.id]
|
||||
}
|
||||
@conversation = alice.build_conversation(opts)
|
||||
@conversation.created_at = 1.hour.ago
|
||||
@conversation.save!
|
||||
sleep(1)
|
||||
@date = @conversation.created_at
|
||||
opts = {
|
||||
subject: "conversation subject 3",
|
||||
|
|
|
|||
Loading…
Reference in a new issue