mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-08 07:40:08 +09:00
Drop the query plan test
Keep the test of what page_updated_since returns, which covers the rewritten scope; pinning SQLite's plan locks in more than the change needs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0142qgjggdJ2KDdGk7RF9Xm9
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
require "test_helper"
|
||||
|
||||
class Message::PaginationTest < ActiveSupport::TestCase
|
||||
test "messages updated since a time are found through the room and update time index" do
|
||||
assert_match(/USING INDEX index_messages_on_room_id_and_updated_at \(room_id=\? AND updated_at>\?\)/, plan_of_page_updated_since)
|
||||
end
|
||||
|
||||
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)
|
||||
@@ -17,15 +13,4 @@ class Message::PaginationTest < ActiveSupport::TestCase
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def plan_of_page_updated_since
|
||||
statements = []
|
||||
callback = ->(*, payload) { statements << payload[:sql] if payload[:sql].start_with?(%(SELECT "messages")) }
|
||||
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
|
||||
rooms(:watercooler).messages.page_updated_since(1.minute.ago)
|
||||
end
|
||||
|
||||
Message.connection.select_rows("EXPLAIN QUERY PLAN #{statements.sole}").map(&:last).join(" | ")
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user