mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-17 11:33:28 +00:00
DEV: Don’t use Chat::MessageCreator
in specs
As message creation is being rewritten in https://github.com/discourse/discourse/pull/22390, a new way of using the underlying service to create chat messages has been implemented in https://github.com/discourse/discourse/pull/23222. This patch uses the new fabricator option which will prevent breaking specs from this plugin when the main PR will be merged.
This commit is contained in:
parent
00d69b463e
commit
65091690eb
@ -38,16 +38,17 @@ describe DiscourseAi::Toxicity::EntryPoint do
|
|||||||
|
|
||||||
context "when creating a chat message" do
|
context "when creating a chat message" do
|
||||||
fab!(:public_chat_channel) { Fabricate(:chat_channel) }
|
fab!(:public_chat_channel) { Fabricate(:chat_channel) }
|
||||||
let(:creator) do
|
|
||||||
Chat::MessageCreator.new(
|
|
||||||
chat_channel: public_chat_channel,
|
|
||||||
user: user,
|
|
||||||
content: "This is my new test",
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "queues a job when creating a chat message" do
|
it "queues a job when creating a chat message" do
|
||||||
expect { creator.create }.to change(Jobs::ToxicityClassifyChatMessage.jobs, :size).by(1)
|
expect {
|
||||||
|
Fabricate(
|
||||||
|
:chat_message,
|
||||||
|
chat_channel: public_chat_channel,
|
||||||
|
user: user,
|
||||||
|
message: "This is my new test",
|
||||||
|
use_service: true,
|
||||||
|
)
|
||||||
|
}.to change(Jobs::ToxicityClassifyChatMessage.jobs, :size).by(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user