From 0ae4b2c3e48ad7e3deeddd571f80fd40f2a971b7 Mon Sep 17 00:00:00 2001 From: Yury Lebedev Date: Wed, 27 Nov 2024 16:27:40 +0100 Subject: [PATCH] Add specs for AppSec ActiveRecord instrumentation --- .../appsec/contrib/active_record/multi_adapter_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/datadog/appsec/contrib/active_record/multi_adapter_spec.rb b/spec/datadog/appsec/contrib/active_record/multi_adapter_spec.rb index 7ce35364975..4080ec0e426 100644 --- a/spec/datadog/appsec/contrib/active_record/multi_adapter_spec.rb +++ b/spec/datadog/appsec/contrib/active_record/multi_adapter_spec.rb @@ -69,6 +69,16 @@ active_record_scope.to_a end + + it 'adds an event to processor context if waf status is :match' do + expect(Datadog::AppSec.active_scope.processor_context).to( + receive(:run).and_return(double(status: :match, actions: {})) + ) + + expect(Datadog::AppSec.active_scope.processor_context.events).to receive(:<<).and_call_original + + active_record_scope.to_a + end end context 'mysql2 adapter' do