test: test: fix typing event specs (#155)
This commit is contained in:
parent
fca269c1d3
commit
45525f7b9b
@ -83,8 +83,7 @@ RSpec.describe 'Conversation Messages API', type: :request do
|
|||||||
|
|
||||||
it 'triggers typing off event for non-private messages' do
|
it 'triggers typing off event for non-private messages' do
|
||||||
params = { content: 'test-message', private: false }
|
params = { content: 'test-message', private: false }
|
||||||
allow(Rails.configuration.dispatcher).to receive(:dispatch)
|
allow(Rails.configuration.dispatcher).to receive(:dispatch).and_call_original
|
||||||
.with('conversation.typing_off', kind_of(Time), hash_including(conversation: conversation, user: agent, is_private: false))
|
|
||||||
|
|
||||||
post api_v1_account_conversation_messages_url(account_id: account.id, conversation_id: conversation.display_id),
|
post api_v1_account_conversation_messages_url(account_id: account.id, conversation_id: conversation.display_id),
|
||||||
params: params,
|
params: params,
|
||||||
@ -93,12 +92,12 @@ RSpec.describe 'Conversation Messages API', type: :request do
|
|||||||
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||||
|
.with('conversation.typing_off', kind_of(Time), hash_including(conversation: conversation, user: agent, is_private: false))
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'triggers typing off event for private messages' do
|
it 'triggers typing off event for private messages' do
|
||||||
params = { content: 'test-message', private: true }
|
params = { content: 'test-message', private: true }
|
||||||
allow(Rails.configuration.dispatcher).to receive(:dispatch).with('conversation.typing_off', kind_of(Time),
|
allow(Rails.configuration.dispatcher).to receive(:dispatch).and_call_original
|
||||||
hash_including(conversation: conversation, user: agent, is_private: true))
|
|
||||||
|
|
||||||
post api_v1_account_conversation_messages_url(account_id: account.id, conversation_id: conversation.display_id),
|
post api_v1_account_conversation_messages_url(account_id: account.id, conversation_id: conversation.display_id),
|
||||||
params: params,
|
params: params,
|
||||||
@ -107,6 +106,7 @@ RSpec.describe 'Conversation Messages API', type: :request do
|
|||||||
|
|
||||||
expect(response).to have_http_status(:success)
|
expect(response).to have_http_status(:success)
|
||||||
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
expect(Rails.configuration.dispatcher).to have_received(:dispatch)
|
||||||
|
.with('conversation.typing_off', kind_of(Time), hash_including(conversation: conversation, user: agent, is_private: true))
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when api inbox' do
|
context 'when api inbox' do
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user