From eb073febb023101c7206ae1e76f52307f1630e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guitaut?= Date: Mon, 27 Nov 2023 14:31:34 +0100 Subject: [PATCH] DEV: Fix a flaky spec MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes, the topic id actually exists for that spec (id being 1) and it will raise about not finding the group id instead of not finding the provided topic because the assignees group wasn’t provided in the `fields` parameter. --- spec/lib/random_assign_utils_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/lib/random_assign_utils_spec.rb b/spec/lib/random_assign_utils_spec.rb index 0f54802..5e70ed4 100644 --- a/spec/lib/random_assign_utils_spec.rb +++ b/spec/lib/random_assign_utils_spec.rb @@ -207,10 +207,12 @@ RSpec.describe RandomAssignUtils do end context "when assigned_topic is not found" do - let(:fields) { { "assigned_topic" => { "value" => 1 } } } + let(:fields) do + { "assigned_topic" => { "value" => -1 }, "assignees_group" => { "value" => group_1.id } } + end it "raises an error" do - expect { auto_assign }.to raise_error(/Topic\(1\) not found/) + expect { auto_assign }.to raise_error(/Topic\(-1\) not found/) end end