mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
DEV: Fix a flaky bookmarks test (#15129)
* DEV: Specify bookmarks order It's better to order by id than to have a semi-random order. Fixes a flaky test: ``` 1) TopicView with a few sample posts #bookmarks gets the first post bookmark reminder at for the user 59 Failure/Error: expect(first[:post_id]).to eq(bookmark1.post_id) 60 61 expected: 1901 62 got: 1902 63 64 (compared using ==) 65 # ./spec/components/topic_view_spec.rb:420:in `block (4 levels) in <main>' 66 # ./spec/rails_helper.rb:284:in `block (2 levels) in <top (required)>' 67 # ./vendor/bundle/ruby/2.7.0/gems/webmock-3.14.0/lib/webmock/rspec.rb:37:in `block (2 levels) in <top (required)>' 68 ``` * Change test * Revert "DEV: Specify bookmarks order" This reverts commit 1f50026231c4d5e1823e8d0d79770fa73ff09f1c.
This commit is contained in:
@ -416,7 +416,7 @@ describe TopicView do
|
||||
it "gets the first post bookmark reminder at for the user" do
|
||||
topic_view = TopicView.new(topic.id, user)
|
||||
|
||||
first, second = topic_view.bookmarks
|
||||
first, second = topic_view.bookmarks.sort_by(&:id)
|
||||
expect(first[:post_id]).to eq(bookmark1.post_id)
|
||||
expect(first[:reminder_at]).to eq_time(bookmark1.reminder_at)
|
||||
expect(second[:post_id]).to eq(bookmark2.post_id)
|
||||
|
Reference in New Issue
Block a user