Skip to content

Commit

Permalink
Add test for not purging non referenced files
Browse files Browse the repository at this point in the history
This was probably fixed between Rails 7.1 and Rails c6ef898 (current main)

We encountered this problem on Rails 7.1
  • Loading branch information
Dorian Marié committed Jan 12, 2024
1 parent c6ef898 commit 5ec0ca7
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions actiontext/test/integration/purge_later_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# frozen_string_literal: true

require "test_helper"

class ActionText::PurgeLaterTest < ActiveJob::TestCase
test "doesn't delete the files" do
blob = create_file_blob(filename: "racecar.jpg", content_type: "image/jpeg")
message = Message.create!(content: ActionText::Content.new.append_attachables(blob))
assert_equal 1, message.content.body.attachables.size
assert_equal 1, message.content.embeds.size
message.update!(content: "")
perform_enqueued_jobs
assert_equal 0, message.content.body.attachables.size
assert_equal 1, message.content.embeds.size
assert_nothing_raised { blob.download }
end
end

0 comments on commit 5ec0ca7

Please sign in to comment.