FIX: flaky search-spec

FIX: flaky search-spec

More precise expectations for search spec

diff --git a/spec/lib/search_spec.rb b/spec/lib/search_spec.rb
index 86e9992..6ed8332 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

GitHub sha: a6363170e9c91384292bd4fa5f497803a4eae906

This commit appears in #13561 which was approved by tgxworld. It was merged by tgxworld.