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:
GPT on behalf of DHH
2026-10-07 10:32:12 +02:00
4 changed files with 27 additions and 2 deletions
+16
View File
@@ -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