From ad55a8db6aa910ad8118401f68d9cca937bc6670 Mon Sep 17 00:00:00 2001 From: Tanmay Deep Sharma Date: Wed, 18 Mar 2026 18:57:47 +0530 Subject: [PATCH] fix: update spec stubs for WhatsApp API v22.0 and correct job queue name --- spec/jobs/webhooks/whatsapp_events_job_spec.rb | 2 +- .../providers/whatsapp_cloud_service_spec.rb | 14 +++++++------- .../whatsapp/send_on_whatsapp_service_spec.rb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/jobs/webhooks/whatsapp_events_job_spec.rb b/spec/jobs/webhooks/whatsapp_events_job_spec.rb index ba8a19413..9994156b5 100644 --- a/spec/jobs/webhooks/whatsapp_events_job_spec.rb +++ b/spec/jobs/webhooks/whatsapp_events_job_spec.rb @@ -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 diff --git a/spec/services/whatsapp/providers/whatsapp_cloud_service_spec.rb b/spec/services/whatsapp/providers/whatsapp_cloud_service_spec.rb index 156e46349..ac5177d0b 100644 --- a/spec/services/whatsapp/providers/whatsapp_cloud_service_spec.rb +++ b/spec/services/whatsapp/providers/whatsapp_cloud_service_spec.rb @@ -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 ) diff --git a/spec/services/whatsapp/send_on_whatsapp_service_spec.rb b/spec/services/whatsapp/send_on_whatsapp_service_spec.rb index c27295b3e..75a3632dc 100644 --- a/spec/services/whatsapp/send_on_whatsapp_service_spec.rb +++ b/spec/services/whatsapp/send_on_whatsapp_service_spec.rb @@ -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' => '*/*',