2023-03-07 13:39:28 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
describe Plugin::Instance do
|
2024-12-02 12:18:03 -05:00
|
|
|
before { SiteSetting.discourse_ai_enabled = true }
|
2024-02-16 13:57:14 -05:00
|
|
|
|
|
|
|
describe "current_user_serializer#ai_helper_prompts" do
|
|
|
|
fab!(:user)
|
|
|
|
|
|
|
|
before do
|
2024-06-19 17:01:35 -04:00
|
|
|
assign_fake_provider_to(:ai_helper_model)
|
2024-08-12 18:40:23 -04:00
|
|
|
SiteSetting.ai_helper_enabled = true
|
2024-02-16 13:57:14 -05:00
|
|
|
SiteSetting.ai_helper_illustrate_post_model = "disabled"
|
|
|
|
Group.find_by(id: Group::AUTO_GROUPS[:admins]).add(user)
|
2024-02-18 23:21:55 -05:00
|
|
|
|
|
|
|
DiscourseAi::AiHelper::Assistant.clear_prompt_cache!
|
2024-02-16 13:57:14 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
let(:serializer) { CurrentUserSerializer.new(user, scope: Guardian.new(user)) }
|
|
|
|
|
|
|
|
it "returns the available prompts" do
|
|
|
|
expect(serializer.ai_helper_prompts).to be_present
|
2024-11-24 16:33:54 -05:00
|
|
|
expect(serializer.ai_helper_prompts.object.count).to eq(7)
|
2024-02-16 13:57:14 -05:00
|
|
|
end
|
|
|
|
end
|
2023-03-07 13:39:28 -05:00
|
|
|
end
|