From 08cfc85b26479df00ae17611fc542d60d7ad98be Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Thu, 30 Oct 2025 18:34:58 +0530 Subject: [PATCH] style: fix rubocop reported issues --- .../new_conversation_strategy_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/services/mailbox/conversation_finder_strategies/new_conversation_strategy_spec.rb b/spec/services/mailbox/conversation_finder_strategies/new_conversation_strategy_spec.rb index 0984fac3e..f790c97d9 100644 --- a/spec/services/mailbox/conversation_finder_strategies/new_conversation_strategy_spec.rb +++ b/spec/services/mailbox/conversation_finder_strategies/new_conversation_strategy_spec.rb @@ -48,7 +48,10 @@ RSpec.describe Mailbox::ConversationFinderStrategies::NewConversationStrategy do context 'with existing contact' do let!(:existing_contact) { create(:contact, email: 'sender@example.com', account: account) } - let!(:contact_inbox) { create(:contact_inbox, contact: existing_contact, inbox: email_channel.inbox) } + + before do + create(:contact_inbox, contact: existing_contact, inbox: email_channel.inbox) + end it 'creates conversation with existing contact' do strategy = described_class.new(mail) @@ -120,7 +123,9 @@ RSpec.describe Mailbox::ConversationFinderStrategies::NewConversationStrategy do context 'when contact creation fails' do before do - allow_any_instance_of(ContactInboxWithContactBuilder).to receive(:perform).and_raise(ActiveRecord::RecordInvalid) + builder = instance_double(ContactInboxWithContactBuilder) + allow(ContactInboxWithContactBuilder).to receive(:new).and_return(builder) + allow(builder).to receive(:perform).and_raise(ActiveRecord::RecordInvalid) end it 'rolls back the transaction' do