From c82a8d38c0492598d0fe464b39465cc7988bf47e Mon Sep 17 00:00:00 2001 From: John-Mason Shackelford Date: Wed, 8 Apr 2026 14:45:02 -0400 Subject: [PATCH] fix: Use correct room messages in pagination tests Fixed test bug identified by Copilot code review: pagination tests were using Message.first and Message.last which could return messages from different rooms than the test's @room (watercooler). Now explicitly using messages(:fourth) and messages(:thirteenth) which are fixtures belonging to the watercooler room where bender bot is a member. Co-authored-by: openhands --- test/controllers/messages/by_bots_controller_test.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/controllers/messages/by_bots_controller_test.rb b/test/controllers/messages/by_bots_controller_test.rb index 5a56b1d..f1122da 100644 --- a/test/controllers/messages/by_bots_controller_test.rb +++ b/test/controllers/messages/by_bots_controller_test.rb @@ -79,12 +79,16 @@ class Messages::ByBotsControlleTest < ActionDispatch::IntegrationTest end test "index supports pagination with before parameter" do - get room_bot_messages_index_url(@room, users(:bender).bot_key, before: Message.last.id) + # Use a message from the watercooler room (where bender is a member) + message_in_room = messages(:thirteenth) # Latest message in watercooler + get room_bot_messages_index_url(@room, users(:bender).bot_key, before: message_in_room.id) assert_response :success end test "index supports pagination with after parameter" do - get room_bot_messages_index_url(@room, users(:bender).bot_key, after: Message.first.id) + # Use a message from the watercooler room (where bender is a member) + message_in_room = messages(:fourth) # First message in watercooler + get room_bot_messages_index_url(@room, users(:bender).bot_key, after: message_in_room.id) assert_response :success end