From 05efa13e93436233baf2863097fd90a3c638cf6d Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 14 Nov 2024 08:55:23 +0000 Subject: [PATCH] Created a failing spec While investigating an issue of missing data we started investigating the implementation of sending events while inside Rails transactions. This commit reproduces a bug that may be contributing to some of our data issues. The existing spec assets that no events are send if the transaction is rolled back, however the spec was passing due to `allowlist_fields` not being set. After setting the `allowlist_fields` we see a test failure as the `SendEvents` job is called. --- spec/dfe/analytics/entities_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/dfe/analytics/entities_spec.rb b/spec/dfe/analytics/entities_spec.rb index 9dcd8669..5009fe84 100644 --- a/spec/dfe/analytics/entities_spec.rb +++ b/spec/dfe/analytics/entities_spec.rb @@ -250,6 +250,7 @@ end describe 'rollback behavior' do + let(:allowlist_fields) { %w[email_address first_name] } it 'does not send create event if the transaction is rolled back' do ActiveRecord::Base.transaction do Candidate.create(id: 123)