mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-05 17:00:34 +00:00
c.f. de983796e1b66aa2ab039a4fb6e32cec8a65a098 There will soon be additional login_required checks for Guardian, and the intent of many checks by automated systems is better fulfilled by using BasicUser, which simulates a logged in TL0 forum user, rather than an anon user.
28 lines
760 B
Ruby
28 lines
760 B
Ruby
# frozen_string_literal: true
|
|
|
|
RSpec.describe AiChatChannelSerializer do
|
|
fab!(:admin) { Fabricate(:admin) }
|
|
|
|
describe "#title" do
|
|
context "when the channel is a DM" do
|
|
fab!(:dm_channel) { Fabricate(:direct_message_channel) }
|
|
|
|
it "display every participant" do
|
|
serialized = described_class.new(dm_channel, scope: admin.guardian, root: nil)
|
|
|
|
expect(serialized.title).to eq(dm_channel.title(nil))
|
|
end
|
|
end
|
|
|
|
context "when the channel is a regular one" do
|
|
fab!(:channel) { Fabricate(:chat_channel) }
|
|
|
|
it "displays the category title" do
|
|
serialized = described_class.new(channel, scope: admin.guardian, root: nil)
|
|
|
|
expect(serialized.title).to eq(channel.title)
|
|
end
|
|
end
|
|
end
|
|
end
|