DEV: Improve flaky time-sensitive specs (#9141)

This commit is contained in:
Jarek Radosz
2020-03-10 22:13:17 +01:00
committed by GitHub
parent f795c1b8e8
commit 29b35aa64c
49 changed files with 334 additions and 331 deletions

View File

@ -75,15 +75,13 @@ describe TopicQuery do
end
context "prioritize_pinned_topics" do
it "does the pagination correctly" do
num_topics = 15
per_page = 3
topics = []
(num_topics - 1).downto(0).each do |i|
topics[i] = Fabricate(:topic)
topics[i] = freeze_time(i.seconds.ago) { Fabricate(:topic) }
end
topic_query = TopicQuery.new(user)
@ -99,7 +97,6 @@ describe TopicQuery do
page: 1)
).to eq(topics[per_page...num_topics])
end
end
context 'bookmarks' do
@ -926,7 +923,7 @@ describe TopicQuery do
let!(:user) { group_user }
it 'should return the group topics' do
expect(suggested_topics).to eq([private_group_topic.id, private_message.id])
expect(suggested_topics).to match_array([private_group_topic.id, private_message.id])
end
end