tech(spec): perf, instructeurs/procedures#show, start tracking request count on procedure show

This commit is contained in:
mfo 2024-06-21 16:11:34 +02:00
parent d7f953f08c
commit 4c5e0c245c
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC

View file

@ -330,6 +330,20 @@ describe Instructeurs::ProceduresController, type: :controller do
it { expect(assigns(:filtered_sorted_paginated_ids)).to match_array([new_unfollow_dossier].map(&:id)) }
end
context 'with pagination' do
let(:dossiers) { 26.times.map { create(:dossier, :en_instruction, procedure: procedure) } }
before { dossiers }
it 'keeps request count stable' do
count = 0
callback = lambda { |*_args| count += 1 }
ActiveSupport::Notifications.subscribed(callback, "sql.active_record") do
subject
expect(assigns(:projected_dossiers).size).to eq(25)
end
expect(count).to eq(43)
end
end
context 'with a dossier en contruction hidden by user' do
let!(:hidden_dossier) { create(:dossier, :en_construction, groupe_instructeur: gi_2, hidden_by_user_at: 1.hour.ago) }
before { subject }