spec: reply from triggers live event
this is in relation to VICE-3599 this test proves that, the reply_from method in ConversationMessage and Conversation (this method processes) Incoming mail as replies to a conversation: triggers a live event if the end user does not see the live event, the problem could be somewhere else, this could require LiveEvents expertise more than ConversationMessage expertise Change-Id: I20469ef44d1ad1bcc6785adf845bf6f4ccc36595 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/322376 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Drake Harper <drake.harper@instructure.com> Reviewed-by: Jason Gillett <jason.gillett@instructure.com> QA-Review: Drake Harper <drake.harper@instructure.com> Product-Review: Drake Harper <drake.harper@instructure.com> Product-Review: Jason Gillett <jason.gillett@instructure.com>
This commit is contained in:
parent
fa752b25eb
commit
6e7b90958b
|
@ -321,6 +321,29 @@ describe Canvas::LiveEvents do
|
|||
Canvas::LiveEvents.conversation_message_created(convo_message)
|
||||
end
|
||||
|
||||
it "triggers live event from Incoming Mail (via reply_from) method" do
|
||||
# when a user replies to a conversation via email, the IncomingMailProcessor
|
||||
# looks up the reply_from method of the object, in this case,
|
||||
# reply_from creates a new ConversationMessage and adds it to the conversation
|
||||
# this spec should prove that the live event is triggered from the "reply_from"
|
||||
allow(LiveEvents).to receive(:post_event)
|
||||
user1 = user_model
|
||||
user2 = user_model
|
||||
convo = Conversation.initiate([user1, user2], false)
|
||||
convo_message = convo.reply_from({ user: user1, text: "this is an example incoming mail reply" })
|
||||
expect(LiveEvents).to have_received(:post_event).with(
|
||||
context: nil,
|
||||
event_name: "conversation_message_created",
|
||||
time: anything,
|
||||
payload: {
|
||||
author_id: convo_message.author_id.to_s,
|
||||
conversation_id: convo_message.conversation_id.to_s,
|
||||
message_id: convo_message.id.to_s,
|
||||
created_at: convo_message.created_at
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
it "doesnt include conversation_id" do
|
||||
user = user_model
|
||||
msg = Conversation.build_message(user, "lorem ipsum")
|
||||
|
|
Loading…
Reference in New Issue