From d57df5b8891039f5dfe567369facfa707d2ac8d6 Mon Sep 17 00:00:00 2001 From: sneakers-the-rat Date: Wed, 24 Jan 2024 20:47:10 -0800 Subject: [PATCH] tests: for the love of god all the tests happen so fast the post IDs dont necessarily increment --- spec/models/public_feed_spec.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spec/models/public_feed_spec.rb b/spec/models/public_feed_spec.rb index 385f3909804f48..4d713a5353a77f 100644 --- a/spec/models/public_feed_spec.rb +++ b/spec/models/public_feed_spec.rb @@ -67,17 +67,20 @@ boost = Fabricate(:status, reblog_of_id: status.id, account: poster) expect(subject).to include(boost.id) + # sleep for 2ms to make sure the other posts come in a greater snowflake ID + sleep(0.002) + (1..40).each do |_i| Fabricate(:status, account: poster) end # before a second boost, the second page should still include the original boost - second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1000, status.id).map(&:id) + second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).map(&:id) expect(second_page).to include(boost.id) # after a second boost, the second page should no longer include the original boost second_boost = Fabricate(:status, reblog_of_id: status.id, account: booster) - second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1000, status.id).map(&:id) + second_page = described_class.new(nil, with_reblogs: true).get(20, boost.id + 1, status.id).map(&:id) expect(subject).to include(second_boost.id) expect(second_page).to_not include(boost.id)