fix: update spec stubs for WhatsApp API v22.0 and correct job queue name

This commit is contained in:
Tanmay Deep Sharma
2026-03-18 18:57:47 +05:30
parent e2deb157a4
commit ad55a8db6a
3 changed files with 9 additions and 9 deletions
@@ -31,7 +31,7 @@ RSpec.describe Webhooks::WhatsappEventsJob do
it 'enqueues the job' do
expect { job.perform_later(params) }.to have_enqueued_job(described_class)
.with(params)
.on_queue('low')
.on_queue('default')
end
context 'when whatsapp_cloud provider' do
@@ -25,7 +25,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
describe '#send_message' do
context 'when called' do
it 'calls message endpoints for normal messages' do
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: {
messaging_product: 'whatsapp',
@@ -40,7 +40,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
end
it 'calls message endpoints for a reply to messages' do
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: {
messaging_product: 'whatsapp',
@@ -60,7 +60,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
attachment = message.attachments.new(account_id: message.account_id, file_type: :image)
attachment.file.attach(io: Rails.root.join('spec/assets/avatar.png').open, filename: 'avatar.png', content_type: 'image/png')
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: hash_including({
messaging_product: 'whatsapp',
@@ -79,7 +79,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
# ref: https://github.com/bblimke/webmock/issues/900
# reason for Webmock::API.hash_including
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: hash_including({
messaging_product: 'whatsapp',
@@ -106,7 +106,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
{ title: 'Sushi', value: 'Sushi' }
]
})
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: {
messaging_product: 'whatsapp', to: '+123456789',
@@ -133,7 +133,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
sections: [{ rows: %w[Burito Pasta Sushi Salad].map { |i| { id: i, title: i } } }]
}.to_json
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: {
messaging_product: 'whatsapp', to: '+123456789',
@@ -181,7 +181,7 @@ describe Whatsapp::Providers::WhatsappCloudService do
context 'when called' do
it 'calls message endpoints with template params for template messages' do
stub_request(:post, 'https://graph.facebook.com/v13.0/123456789/messages')
stub_request(:post, 'https://graph.facebook.com/v22.0/123456789/messages')
.with(
body: template_body.to_json
)
@@ -138,7 +138,7 @@ describe Whatsapp::SendOnWhatsappService do
processed_params: { 'body' => { 'last_name' => 'Dale', 'ticket_id' => '2332' } }
}
stub_request(:post, "https://graph.facebook.com/v13.0/#{whatsapp_cloud_channel.provider_config['phone_number_id']}/messages")
stub_request(:post, "https://graph.facebook.com/v22.0/#{whatsapp_cloud_channel.provider_config['phone_number_id']}/messages")
.with(
:headers => {
'Accept' => '*/*',