Revert "chore: Upgrade Rails to 7.2.2 and update Gemfile dependencies (#11037)"
This reverts commit ef6ba8aabd.
This commit is contained in:
@@ -42,11 +42,6 @@ describe Telegram::IncomingMessageService do
|
||||
}
|
||||
end
|
||||
|
||||
def contact_for(source_id = nil)
|
||||
source_id ||= message_params.dig('from', 'id')
|
||||
ContactInbox.find_by!(inbox: telegram_channel.inbox, source_id: source_id).contact
|
||||
end
|
||||
|
||||
describe '#perform' do
|
||||
context 'when valid text message params' do
|
||||
it 'creates appropriate conversations, message and contacts' do
|
||||
@@ -56,7 +51,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.content).to eq('test')
|
||||
end
|
||||
end
|
||||
@@ -69,9 +64,9 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(contact_for.additional_attributes['social_telegram_user_id']).to eq(23)
|
||||
expect(contact_for.additional_attributes['social_telegram_user_name']).to eq('sojan')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.additional_attributes['social_telegram_user_id']).to eq(23)
|
||||
expect(Contact.all.first.additional_attributes['social_telegram_user_name']).to eq('sojan')
|
||||
expect(telegram_channel.inbox.messages.first.content).to eq('test')
|
||||
end
|
||||
end
|
||||
@@ -112,7 +107,7 @@ describe Telegram::IncomingMessageService do
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(telegram_channel.inbox.conversations.last.additional_attributes).to include({ 'chat_id' => 23,
|
||||
'business_connection_id' => 'eooW3KF5WB5HxTD7T826' })
|
||||
contact = contact_for
|
||||
contact = Contact.all.first
|
||||
expect(contact.name).to eq('Sojan Jose')
|
||||
expect(contact.additional_attributes['language_code']).to eq('en')
|
||||
message = telegram_channel.inbox.messages.first
|
||||
@@ -136,7 +131,7 @@ describe Telegram::IncomingMessageService do
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(telegram_channel.inbox.conversations.last.additional_attributes).to include({ 'chat_id' => 23,
|
||||
'business_connection_id' => 'eooW3KF5WB5HxTD7T826' })
|
||||
contact = contact_for
|
||||
contact = Contact.all.first
|
||||
expect(contact.name).to eq('Sojan Jose')
|
||||
# TODO: The language code is not present when we send the first message to the client.
|
||||
# Should we update it when the user replies?
|
||||
@@ -166,9 +161,9 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(contact_for.additional_attributes['social_telegram_user_id']).to eq(23)
|
||||
expect(contact_for.additional_attributes['social_telegram_user_name']).to eq('sojan')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.additional_attributes['social_telegram_user_id']).to eq(23)
|
||||
expect(Contact.all.first.additional_attributes['social_telegram_user_name']).to eq('sojan')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('audio')
|
||||
end
|
||||
end
|
||||
@@ -187,7 +182,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('image')
|
||||
end
|
||||
end
|
||||
@@ -212,7 +207,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('image')
|
||||
end
|
||||
end
|
||||
@@ -234,7 +229,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('video')
|
||||
end
|
||||
end
|
||||
@@ -263,7 +258,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('video')
|
||||
end
|
||||
end
|
||||
@@ -282,7 +277,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('audio')
|
||||
end
|
||||
end
|
||||
@@ -303,7 +298,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('file')
|
||||
end
|
||||
end
|
||||
@@ -341,7 +336,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('location')
|
||||
end
|
||||
|
||||
@@ -360,7 +355,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
|
||||
attachment = telegram_channel.inbox.messages.first.attachments.first
|
||||
expect(attachment.file_type).to eq('location')
|
||||
@@ -393,8 +388,8 @@ describe Telegram::IncomingMessageService do
|
||||
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for(5_171_248).name).to eq('Sojan Jose')
|
||||
expect(contact_for(5_171_248).additional_attributes['social_telegram_user_id']).to eq(5_171_248)
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.additional_attributes['social_telegram_user_id']).to eq(5_171_248)
|
||||
expect(telegram_channel.inbox.messages.first.content).to eq('Option 1')
|
||||
end
|
||||
end
|
||||
@@ -411,7 +406,7 @@ describe Telegram::IncomingMessageService do
|
||||
}.with_indifferent_access
|
||||
described_class.new(inbox: telegram_channel.inbox, params: params).perform
|
||||
expect(telegram_channel.inbox.conversations.count).not_to eq(0)
|
||||
expect(contact_for.name).to eq('Sojan Jose')
|
||||
expect(Contact.all.first.name).to eq('Sojan Jose')
|
||||
expect(telegram_channel.inbox.messages.first.attachments.first.file_type).to eq('contact')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user