FIX: flaky search-spec

More precise expectations for search spec
This commit is contained in:
Krzysztof Kotlarek 2021-06-29 11:17:49 +10:00 committed by Alan Guo Xiang Tan
parent 5af0636d83
commit a6363170e9

View File

@ -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