From a6363170e9c91384292bd4fa5f497803a4eae906 Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 29 Jun 2021 11:17:49 +1000 Subject: [PATCH] FIX: flaky search-spec More precise expectations for search spec --- spec/lib/search_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rb index 86e9992d447..6ed833283e3 100644 --- a/spec/lib/search_spec.rb +++ b/spec/lib/search_spec.rb @@ -157,11 +157,11 @@ describe Search do SearchIndexer.index(user2, force: true) result = Search.execute("test", guardian: Guardian.new(user2)) - expect(result.users.first.custom_data).to eq([ + expect(result.users.find { |u| u.id == user.id }.custom_data).to eq([ { name: "custom field", value: "test" }, { name: "another custom field", value: "longer test" } ]) - expect(result.users.last.custom_data).to eq([ + expect(result.users.find { |u| u.id == user2.id }.custom_data).to eq([ { name: "another custom field", value: "second user test" } ]) end