DEV: updates spec following changes in chat (#604)
Also makes this spec to use the `update_message!` helper.
This commit is contained in:
parent
ab78d9b597
commit
dacc1b9f28
|
@ -54,16 +54,12 @@ describe DiscourseAi::Toxicity::EntryPoint do
|
||||||
# This fabricator trigger events because it uses the UpdateMessage service.
|
# This fabricator trigger events because it uses the UpdateMessage service.
|
||||||
# Using let makes the test fail.
|
# Using let makes the test fail.
|
||||||
fab!(:chat_message)
|
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
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue