# frozen_string_literal: true
require "rails_helper"
RSpec.describe SharedAiConversation, type: :model do
before do
SiteSetting.discourse_ai_enabled = true
SiteSetting.ai_bot_enabled_chat_bots = "claude-2"
SiteSetting.ai_bot_enabled = true
end
fab!(:user)
let(:raw_with_details) { <<~HTML }
GitHub pull request diff
This is some other text
HTML let(:bot_user) { User.find(DiscourseAi::AiBot::EntryPoint::CLAUDE_V2_ID) } let!(:topic) { Fabricate(:private_message_topic, recipient: bot_user) } let!(:post1) { Fabricate(:post, topic: topic, post_number: 1) } let!(:post2) { Fabricate(:post, topic: topic, post_number: 2, raw: raw_with_details) } describe ".share_conversation" do it "creates a new conversation if one does not exist" do expect { described_class.share_conversation(user, topic) }.to change { described_class.count }.by(1) end it "generates a good onebox" do conversation = described_class.share_conversation(user, topic) onebox = conversation.onebox expect(onebox).not_to include("GitHub pull request diff") expect(onebox).not_to include("