mirror of
https://github.com/basecamp/once-campfire.git
synced 2026-10-09 16:20:09 +09:00
Retain content-validated message fragments across unrelated commits
This commit is contained in:
@@ -74,6 +74,21 @@ class FragmentRenderingTest < ActionDispatch::IntegrationTest
|
||||
assert_select "form[action=?]", message_boosts_path(@message)
|
||||
end
|
||||
|
||||
test "a commit in another room retains content-validated message collection hits" do
|
||||
ResponseCache.instance.stubs(:budget).returns(0)
|
||||
get room_messages_url(@room)
|
||||
assert_response :success
|
||||
foreign_write("UPDATE rooms SET name = ? WHERE id = ?", "Unrelated room rename", rooms(:pets).id)
|
||||
collections = []
|
||||
ActiveSupport::Notifications.subscribed(->(event) { collections << event.payload }, "render_collection.action_view") do
|
||||
get room_messages_url(@room)
|
||||
end
|
||||
assert_response :success
|
||||
messages = collections.find { |payload| payload[:identifier].end_with?("messages/_message.html.erb") }
|
||||
assert messages
|
||||
assert_equal @room.messages.count, messages[:cache_hits]
|
||||
end
|
||||
|
||||
test "a foreign commit after capture bypasses old native fragment lookups" do
|
||||
ResponseCache.instance.stubs(:budget).returns(0)
|
||||
get room_messages_url(@room)
|
||||
|
||||
Reference in New Issue
Block a user