DEV: updates spec following changes in chat (#604)

Also makes this spec to use the `update_message!` helper.
This commit is contained in:
Joffrey JAFFEUX 2024-05-07 15:01:06 +02:00 committed by GitHub
parent ab78d9b597
commit dacc1b9f28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 8 deletions

View File

@ -54,16 +54,12 @@ describe DiscourseAi::Toxicity::EntryPoint do
# This fabricator trigger events because it uses the UpdateMessage service.
# Using let makes the test fail.
fab!(:chat_message)
let(:updater) do
Chat::UpdateMessage.call(
guardian: Guardian.new(chat_message.user),
message_id: chat_message.id,
message: "This is my updated message",
)
end
it "queues a job on chat message update" do
expect { updater.update }.to change(Jobs::ToxicityClassifyChatMessage.jobs, :size).by(1)
expect { update_message!(chat_message, text: "abcdef") }.to change(
Jobs::ToxicityClassifyChatMessage.jobs,
:size,
).by(1)
end
end
end