From e3e88b39ee54173039d80b5b19f4d6d0888efba9 Mon Sep 17 00:00:00 2001 From: Damir Sultanbekov Date: Tue, 26 Nov 2024 11:48:28 +0500 Subject: [PATCH] Fixed spec error. The reason was that there were two records with same impressions_count, so in this case we need to additionally sort records by id, to match TextAPI behaviour --- spec/api/v1/text_api_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/api/v1/text_api_spec.rb b/spec/api/v1/text_api_spec.rb index ca24ad8f..611288e1 100644 --- a/spec/api/v1/text_api_spec.rb +++ b/spec/api/v1/text_api_spec.rb @@ -265,7 +265,7 @@ m.expression.intellectual_property_public_domain? || m.expression.intellectual_property_unknown? end - expect(data_ids).to eq matched.sort_by(&:impressions_count).map(&:id)[0..24] + expect(data_ids).to eq matched.sort_by { |rec| [rec.impressions_count, rec.id] }.map(&:id)[0..24] end end