DEV: Fix a flaky spec (#18995)

topic.posts is not ordered by any column by default
This commit is contained in:
Jarek Radosz 2022-11-16 10:46:30 +01:00 committed by GitHub
parent 41e6b516e5
commit 8e60c50f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -167,7 +167,6 @@ RSpec.describe TopicView do
fab!(:p3) { Fabricate(:post, topic: topic, user: first_poster, percent_rank: 0) }
it "it can find the best responses" do
best2 = TopicView.new(topic.id, evil_trout, best: 2)
expect(best2.posts.count).to eq(2)
expect(best2.posts[0].id).to eq(p2.id)
@ -415,7 +414,7 @@ RSpec.describe TopicView do
describe "#bookmarks" do
let!(:user) { Fabricate(:user) }
let!(:bookmark1) { Fabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.first_post, user: user) }
let!(:bookmark2) { Fabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.posts[1], user: user) }
let!(:bookmark2) { Fabricate(:bookmark_next_business_day_reminder, bookmarkable: topic.posts.order(:post_number)[1], user: user) }
it "gets the first post bookmark reminder at for the user" do
topic_view = TopicView.new(topic.id, user)