From 201d6f5a285e7db1f4e496a93e8907a629640dc4 Mon Sep 17 00:00:00 2001 From: Mattia Roccoberton Date: Sun, 1 Jun 2025 11:05:30 +0200 Subject: [PATCH 1/2] test: Enable failing spec related to the Bullet offense --- spec/integration/attachments_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/integration/attachments_spec.rb b/spec/integration/attachments_spec.rb index 8536d04..9ed77e7 100644 --- a/spec/integration/attachments_spec.rb +++ b/spec/integration/attachments_spec.rb @@ -12,7 +12,7 @@ end let(:test_post) { Post.new(title: 'A test post', some_file: uploaded_file) } - it 'creates the entity with the attached file', :aggregate_failures, :skip_bullet do + it 'creates the entity with the attached file', :aggregate_failures do expect { test_post.save! }.to change(ActiveStorageDB::File, :count).by(1) expect(test_post.some_file).to be_attached From 2e6b1d0211ee0088e40f2cfb4fbfcf5c7fc2db6b Mon Sep 17 00:00:00 2001 From: Mattia Roccoberton Date: Sun, 1 Jun 2025 12:01:17 +0200 Subject: [PATCH 2/2] test: Fix failing spec related to Bullet offense --- spec/integration/attachments_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/spec/integration/attachments_spec.rb b/spec/integration/attachments_spec.rb index 9ed77e7..3084fe6 100644 --- a/spec/integration/attachments_spec.rb +++ b/spec/integration/attachments_spec.rb @@ -12,6 +12,16 @@ end let(:test_post) { Post.new(title: 'A test post', some_file: uploaded_file) } + around do |example| + # NOTE: touch_attachment_records trigger an extra includes on ActiveStorage::Attachment + if ActiveStorage.respond_to?(:touch_attachment_records) + touch_option = ActiveStorage.touch_attachment_records + ActiveStorage.touch_attachment_records = false + example.run + ActiveStorage.touch_attachment_records = touch_option + end + end + it 'creates the entity with the attached file', :aggregate_failures do expect { test_post.save! }.to change(ActiveStorageDB::File, :count).by(1)