Skip to content

Commit 2e6b1d0

Browse files
committed
test: Fix failing spec related to Bullet offense
1 parent 201d6f5 commit 2e6b1d0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

spec/integration/attachments_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@
1212
end
1313
let(:test_post) { Post.new(title: 'A test post', some_file: uploaded_file) }
1414

15+
around do |example|
16+
# NOTE: touch_attachment_records trigger an extra includes on ActiveStorage::Attachment
17+
if ActiveStorage.respond_to?(:touch_attachment_records)
18+
touch_option = ActiveStorage.touch_attachment_records
19+
ActiveStorage.touch_attachment_records = false
20+
example.run
21+
ActiveStorage.touch_attachment_records = touch_option
22+
end
23+
end
24+
1525
it 'creates the entity with the attached file', :aggregate_failures do
1626
expect { test_post.save! }.to change(ActiveStorageDB::File, :count).by(1)
1727

0 commit comments

Comments
 (0)