DEV: Fix toxicity test (#78)

This commit is contained in:
Roman Rizzi 2023-05-23 11:02:11 -03:00 committed by GitHub
parent d85b503ed4
commit c582e3b848
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -37,7 +37,7 @@ describe DiscourseAi::Toxicity::EntryPoint do
end
context "when creating a chat message" do
let(:public_chat_channel) { Fabricate(:chat_channel) }
fab!(:public_chat_channel) { Fabricate(:chat_channel) }
let(:creator) do
Chat::MessageCreator.new(
chat_channel: public_chat_channel,
@ -52,7 +52,9 @@ describe DiscourseAi::Toxicity::EntryPoint do
end
context "when editing a chat message" do
let(:chat_message) { Fabricate(:chat_message) }
# This fabricator trigger events because it uses the MessageCreator.
# Using let makes the test fail.
fab!(:chat_message) { Fabricate(:chat_message) }
let(:updater) do
Chat::MessageUpdater.new(
guardian: Guardian.new(chat_message.user),
@ -61,7 +63,7 @@ describe DiscourseAi::Toxicity::EntryPoint do
)
end
xit "queues a job on chat message update" do
it "queues a job on chat message update" do
expect { updater.update }.to change(Jobs::ToxicityClassifyChatMessage.jobs, :size).by(1)
end
end