mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Merge pull request #312: Find the messages a refresh replaces through an index
Reviewed and merged by GPT on behalf of DHH.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
require "test_helper"
|
||||
|
||||
class Message::PaginationTest < ActiveSupport::TestCase
|
||||
test "messages updated since a time are the newest page of them, in creation order" do
|
||||
room = rooms(:watercooler)
|
||||
first, second, third = room.messages.ordered.first(3)
|
||||
|
||||
travel 1.minute do
|
||||
[ third, first, second ].each(&:touch)
|
||||
|
||||
stub_const(Message::Pagination, :PAGE_SIZE, 2) do
|
||||
assert_equal [ second, third ], room.messages.page_updated_since(30.seconds.ago).to_a
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user