test(voice): align WhatsApp call specs with feature gate and v22 calls path

- call_permission_reply specs: enable channel_voice and set
  provider_config['source'] = 'embedded_signup' so voice_enabled? returns
  true; without it the service short-circuits before any handling.
- whatsapp_cloud_service specs: stub /v22.0/<phone_id>/calls (and
  /messages) to match calls_phone_id_path, which uses
  WHATSAPP_API_VERSION (fallback v22.0). The OSS v13.0 path is locked
  for legacy /messages compatibility only.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tanmay Deep Sharma
2026-05-07 17:12:39 +07:00
co-authored by Claude Opus 4.7
parent f0119b3f2b
commit f6a88d7f12
2 changed files with 6 additions and 3 deletions
@@ -4,8 +4,10 @@ describe Whatsapp::Providers::WhatsappCloudService do
subject(:service) { described_class.new(whatsapp_channel: whatsapp_channel) }
let(:whatsapp_channel) { create(:channel_whatsapp, provider: 'whatsapp_cloud', validate_provider_config: false, sync_templates: false) }
let(:calls_url) { 'https://graph.facebook.com/v13.0/123456789/calls' }
let(:messages_url) { 'https://graph.facebook.com/v13.0/123456789/messages' }
# Call-flow endpoints use the configured WHATSAPP_API_VERSION (fallback v22.0),
# not the OSS v13.0 path locked for legacy /messages compatibility.
let(:calls_url) { 'https://graph.facebook.com/v22.0/123456789/calls' }
let(:messages_url) { 'https://graph.facebook.com/v22.0/123456789/messages' }
let(:headers) { { 'Content-Type' => 'application/json' } }
before { stub_request(:get, /message_templates/) }
@@ -19,7 +19,8 @@ describe Whatsapp::CallPermissionReplyService do
end
before do
channel.provider_config = channel.provider_config.merge('calling_enabled' => true)
account.enable_features!('channel_voice')
channel.provider_config = channel.provider_config.merge('source' => 'embedded_signup', 'calling_enabled' => true)
channel.save!
end