diff --git a/app/services/whatsapp/baileys_handlers/messages_update.rb b/app/services/whatsapp/baileys_handlers/messages_update.rb index 25245e2ec..7e033edf1 100644 --- a/app/services/whatsapp/baileys_handlers/messages_update.rb +++ b/app/services/whatsapp/baileys_handlers/messages_update.rb @@ -53,8 +53,10 @@ module Whatsapp::BaileysHandlers::MessagesUpdate 'read' when 5 Rails.logger.warn 'Baileys unsupported message update status: PLAYED(5)' + nil else Rails.logger.warn "Baileys unsupported message update status: #{status}" + nil end end diff --git a/spec/services/whatsapp/incoming_message_baileys_service_spec.rb b/spec/services/whatsapp/incoming_message_baileys_service_spec.rb index 234998f86..b1cb46799 100644 --- a/spec/services/whatsapp/incoming_message_baileys_service_spec.rb +++ b/spec/services/whatsapp/incoming_message_baileys_service_spec.rb @@ -750,9 +750,11 @@ describe Whatsapp::IncomingMessageBaileysService do it 'logs warning for unsupported played status' do update_payload[:update][:status] = 5 - allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: PLAYED(5)') + allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: PLAYED(5)').and_return(true) - described_class.new(inbox: inbox, params: params).perform + expect do + described_class.new(inbox: inbox, params: params).perform + end.not_to raise_error expect(Rails.logger).to have_received(:warn) end @@ -760,9 +762,11 @@ describe Whatsapp::IncomingMessageBaileysService do it 'logs warning for unsupported status' do update_payload[:update][:status] = 6 - allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: 6') + allow(Rails.logger).to receive(:warn).with('Baileys unsupported message update status: 6').and_return(true) - described_class.new(inbox: inbox, params: params).perform + expect do + described_class.new(inbox: inbox, params: params).perform + end.not_to raise_error expect(Rails.logger).to have_received(:warn) end