From dacc1b9f28a0a932f096e559b7dbc22cc9c1537e Mon Sep 17 00:00:00 2001 From: Joffrey JAFFEUX Date: Tue, 7 May 2024 15:01:06 +0200 Subject: [PATCH] DEV: updates spec following changes in chat (#604) Also makes this spec to use the `update_message!` helper. --- spec/lib/modules/toxicity/entry_point_spec.rb | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/spec/lib/modules/toxicity/entry_point_spec.rb b/spec/lib/modules/toxicity/entry_point_spec.rb index 60ce6f49..3c59987c 100644 --- a/spec/lib/modules/toxicity/entry_point_spec.rb +++ b/spec/lib/modules/toxicity/entry_point_spec.rb @@ -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