From 4db7505550a89cf4e95f92481cacad0fa2b0e23c Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Mon, 20 Jan 2025 16:39:00 +0530 Subject: [PATCH] style: don't use let! --- .../jobs/captain/conversation/response_builder_job_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb b/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb index 81a62da02..cf5e3a1ab 100644 --- a/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb +++ b/spec/enterprise/jobs/captain/conversation/response_builder_job_spec.rb @@ -4,14 +4,15 @@ RSpec.describe Captain::Conversation::ResponseBuilderJob, type: :job do let(:account) { create(:account, custom_attributes: { plan_name: 'startups' }) } let(:inbox) { create(:inbox, account: account) } let(:assistant) { create(:captain_assistant, account: account) } - let!(:captain_inbox_association) { create(:captain_inbox, captain_assistant: assistant, inbox: inbox) } + let(:captain_inbox_association) { create(:captain_inbox, captain_assistant: assistant, inbox: inbox) } describe '#perform' do let(:conversation) { create(:conversation, inbox: inbox, account: account) } - let!(:message) { create(:message, conversation: conversation, content: 'Hello', message_type: :incoming) } let(:mock_llm_chat_service) { double('Captain::Llm::AssistantChatService') } before do + create(:message, conversation: conversation, content: 'Hello', message_type: :incoming) + allow(inbox).to receive(:captain_active?).and_return(true) allow(Captain::Llm::AssistantChatService).to receive(:new).and_return(mock_llm_chat_service) allow(mock_llm_chat_service).to receive(:generate_response).and_return({ 'response' => 'Hey, welcome to Captain Specs' })